describe(".resource(Mixed: Array) with callback", function() { var resultAsCallback; before(function(done) { promise = P.resource(['https://pokeapi.co/api/v2/berry/12', 'https://pokeapi.co/api/v2/berry/11', 'https://pokeapi.co/api/v2/pokemon/12'], function(data) { resultAsCallback = data; done(); }); }); it("should all have property name", function() { return expect(resultAsCallback).to.eventually.all.have.property("name"); }); });
describe(".getPokemonByName(Array: int)", function() { before(function() { promise = P.getPokemonByName([15, 35, 433, 444]); }); it("should succeed", function() { return promise; }); it("should have length 4", function() { return expect(promise).to.eventually.have.length(4); }); it("pokemons should have property height", function() { return expect(promise).to.eventually.all.have.property('height'); }); });
it('should successfully retrieve the official API docs', function() { const promisedOfficialDocs = retrieveOfficialDocs(); return Promise.all([ expect(promisedOfficialDocs).to.eventually.be.fulfilled, expect(promisedOfficialDocs).to.eventually.be.an('object') return Promise.all([ expect(this.pOfficialEndpoints).to.eventually.be.fulfilled, expect(this.pOfficialEndpoints).to.eventually.be.an('array'), expect(this.pOfficialEndpoints).to.eventually.all.have.keys(OFFICIAL_DOC_PARAMS) ]); });
describe(".getBerryByName(Array: int)", function() { before(function() { promise = P.getBerryByName([1, 3, 5]); }); it("should succeed", function() { return promise; }); it("should have length 3", function() { return expect(promise).to.eventually.have.length(3); }); it("berries should have property growth_time", function() { return expect(promise).to.eventually.all.have.property('growth_time'); }); });
describe(".resource(Mixed: Array) secure (with ssl)", function() { before(function() { promise = P.resource(['/api/v2/berry/15','https://pokeapi.co/api/v2/berry/14']); }); it("should succeed", function() { return promise; }); it("should have length 2", function() { return expect(promise).to.eventually.have.length(2); }); it("should have property name", function() { return expect(promise).to.eventually.all.have.property("name"); }); });
// end root endpoints // start normals calls describe(".getBerryByName(Array: string)", function() { before(function() { promise = P.getBerryByName(['cheri', 'chesto', 'pecha']); }); it("should succeed", function() { return promise; }); it("should have length 3", function() { return expect(promise).to.eventually.have.length(3); }); it("berries should have property growth_time", function() { return expect(promise).to.eventually.all.have.property('growth_time'); }); });