Skip to content

Commit 5ad3423

Browse files
Add a new integration test checking credits with a single batch entry
1 parent cfbad26 commit 5ad3423

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

integration_test/ipregistry.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,15 @@ describe('batchLookup', () => {
184184
expect(ipInfoList[2]).to.be.instanceOf(LookupError);
185185
});
186186

187+
it('should consume 1 credit if batch lookup contains only 1 entry', async () => {
188+
const client = new IpregistryClient(API_KEY, new NoCache());
189+
const response = await client.batchLookup(['8.8.4.4']);
190+
191+
expect(response.credits.consumed).equal(1);
192+
expect(response.credits.remaining).greaterThan(0);
193+
expect(response.throttling).null;
194+
});
195+
187196
it('should consume credits for a batch lookup with no cache', async () => {
188197
const client = new IpregistryClient(API_KEY, new NoCache());
189198
const response = await client.batchLookup(['8.8.4.4', '1.2.3.4', '1.2.3.2']);

0 commit comments

Comments
 (0)