it('it shoud return an array', function() { return ccAPI.createClient(ccAPIUrl) .then(function(client) { return GetCharitiesByOneKeyword(client, goodArgs).then(function(val) { expect(val).to.be.instanceof(Array); }); }); });
it('execute promise stack', function() { // console.log('lets go!'); this.timeout(30000); // console.log('setting timeout'); return ccAPI.createClient(ccAPIUrl) .then(function(client) { // console.log('searching for charitites'); return GetCharitiesByKeywordList(client, { APIKey }, ["madrassa"]); }) .then(function(obj) { // console.log('fetching all charities'); const { client, res } = obj; return fetchAllCharities(client, { APIKey }, res); }) .then(function(val) { // console.log(val[0].GetCharityByRegisteredCharityNumberResult); expect(val[0].GetCharityByRegisteredCharityNumberResult).to.have.any.keys([ 'RegisteredCharityNumber', 'SubsidiaryNumber', 'CharityName', 'MainCharityName', 'RegistrationStatus', 'PublicEmailAddress', 'MainPhoneNumber' ]); expect(makeData(val)[0]).to.have.all.keys([ 'CharityName', 'RegisteredCharityNumber', 'RegistrationHistory', 'RegistrationDate', 'Address', 'PublicTelephoneNumber', 'PublicFaxNumber', 'EmailAddress', 'WebsiteAddress', 'Activities', 'Trustees', 'GrossIncome', 'TotalExpenditure', 'Employees', 'Volunteers', ]); // 8 charities of 82 had returns data // 75 charities of 82 had submissions data }) .catch(function(error) { throw error; }); });
it('expect the first object to have all the required keys', function() { return ccAPI.createClient(ccAPIUrl).then(function(client) { return GetCharitiesByOneKeyword(client, goodArgs).then(function(val) { expect(val[0]).to.have.all.keys([ 'RegisteredCharityNumber', 'SubsidiaryNumber', 'CharityName', 'MainCharityName', 'RegistrationStatus', 'PublicEmailAddress', 'MainPhoneNumber' ]); }); }); });
it('should create a valid client', function() { return ccAPI.createClient(ccAPIUrl).then(function(client) { expect(client).to.respondTo('GetCharities'); }); });
before(function() { return ccAPI.createClient(ccAPIUrl).then(function(val) { client = val; }); });