update function name
This commit is contained in:
@@ -3,7 +3,7 @@ const GetFlix = require('../index');
|
|||||||
const getflix = new GetFlix('d9d6007d1bcf12043db5a085ae3e5bbb');
|
const getflix = new GetFlix('d9d6007d1bcf12043db5a085ae3e5bbb');
|
||||||
const getInfo = async () => {
|
const getInfo = async () => {
|
||||||
try {
|
try {
|
||||||
const info = await getflix.getInfo('80244780');
|
const info = await getflix.get('80244780');
|
||||||
console.log(info);
|
console.log(info);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class FlixInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getInfo(netflixId) {
|
get(netflixId) {
|
||||||
|
|
||||||
// Imdb id page
|
// Imdb id page
|
||||||
const flixableURL = config.filexibleURL + netflixId;
|
const flixableURL = config.filexibleURL + netflixId;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "flixinfo",
|
"name": "flixinfo",
|
||||||
"version": "1.1.1",
|
"version": "1.1.3",
|
||||||
"description": "Get movie detail with netflix id",
|
"description": "Get movie detail with netflix id",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ describe('Flix Info', () => {
|
|||||||
|
|
||||||
const flixinfoWrongApiKey = new GetFlix('sfs345k34jlkdflgkjdfglk435j345klj');
|
const flixinfoWrongApiKey = new GetFlix('sfs345k34jlkdflgkjdfglk435j345klj');
|
||||||
|
|
||||||
flixinfoWrongApiKey.getInfo(70143836)
|
flixinfoWrongApiKey.get(70143836)
|
||||||
.catch(result => {
|
.catch(result => {
|
||||||
result.should.have.property('error').equal(1);
|
result.should.have.property('error').equal(1);
|
||||||
result.should.have.property('errorMsg').equal('tmdb find id wrong api key error');
|
result.should.have.property('errorMsg').equal('tmdb find id wrong api key error');
|
||||||
@@ -32,14 +32,14 @@ describe('Flix Info', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#getInfo()', () => {
|
describe('#get()', () => {
|
||||||
|
|
||||||
const flixinfo = new GetFlix('d9d6007d1bcf12043db5a085ae3e5bbb');
|
const flixinfo = new GetFlix('d9d6007d1bcf12043db5a085ae3e5bbb');
|
||||||
|
|
||||||
context('Return result infos', () => {
|
context('Return result infos', () => {
|
||||||
// Movie test
|
// Movie test
|
||||||
it('- movies return right result', (done) => {
|
it('- movies return right result', (done) => {
|
||||||
flixinfo.getInfo(70131314)
|
flixinfo.get(70131314)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
result.should.have.property('result').equal(1);
|
result.should.have.property('result').equal(1);
|
||||||
result.should.have.property('error').equal(0);
|
result.should.have.property('error').equal(0);
|
||||||
@@ -58,7 +58,7 @@ describe('Flix Info', () => {
|
|||||||
});
|
});
|
||||||
// // Tv test
|
// // Tv test
|
||||||
it('- tv series return right result', (done) => {
|
it('- tv series return right result', (done) => {
|
||||||
flixinfo.getInfo(80232926)
|
flixinfo.get(80232926)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
result.should.have.property('result').equal(1);
|
result.should.have.property('result').equal(1);
|
||||||
result.should.have.property('error').equal(0);
|
result.should.have.property('error').equal(0);
|
||||||
@@ -76,7 +76,7 @@ describe('Flix Info', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('- return empty result', (done) => {
|
it('- return empty result', (done) => {
|
||||||
flixinfo.getInfo(70143836)
|
flixinfo.get(70143836)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
result.should.have.property('error').equal(0);
|
result.should.have.property('error').equal(0);
|
||||||
done();
|
done();
|
||||||
@@ -84,7 +84,7 @@ describe('Flix Info', () => {
|
|||||||
});
|
});
|
||||||
it('- flixable.com and tmdb.com connection error', (done) => {
|
it('- flixable.com and tmdb.com connection error', (done) => {
|
||||||
nock.disableNetConnect(); //Prevents making request external connection
|
nock.disableNetConnect(); //Prevents making request external connection
|
||||||
flixinfo.getInfo(70143836)
|
flixinfo.get(70143836)
|
||||||
.catch(result => {
|
.catch(result => {
|
||||||
result.should.have.property('error').equal(1);
|
result.should.have.property('error').equal(1);
|
||||||
result.should.have.property('errorMsg');
|
result.should.have.property('errorMsg');
|
||||||
|
|||||||
Reference in New Issue
Block a user