Skip to content

Commit

Permalink
Test an empty search
Browse files Browse the repository at this point in the history
  • Loading branch information
eatyourgreens committed Apr 2, 2024
1 parent 43bcf0e commit 9aebaa9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/talkClient.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,24 @@ describe('talkClient', function () {
expect(result.body).to.be.a('string');
});
});
specify('should be empty when all results are null', async function () {
// This is a production Talk query that only returns null results.
nock('https://talk-test.zooniverse.org')
.get('/searches?http_cache=true&types=comments&section=zooniverse&page=4&pageSize=10&query=depression')
.reply(200, {
searches: [null, null, null, null, null, null, null, null, null, null]
});

const params = {
types: ['comments'],
section: 'zooniverse',
page: 4,
pageSize: 10,
query: 'depression'
};
const results = await talkClient.type('searches').get(params);
expect(results).to.be.an('array');
expect(results).to.have.lengthOf(0);
});
});
});

0 comments on commit 9aebaa9

Please sign in to comment.