Skip to content

Commit

Permalink
chore: assert node helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts committed Sep 11, 2024
1 parent 1f2d90f commit aa4945c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@ test('sets the ua', () => {
value: expect.stringContaining(`Algolia for JavaScript (${apiClientVersion}); Search (${apiClientVersion}); Fetch`),
});
});

test('forwards node search helpers', () => {
expect(client.generateSecuredApiKey).not.toBeUndefined();
expect(client.getSecuredApiKeyRemainingValidity).not.toBeUndefined();
expect(() => {
const resp = client.generateSecuredApiKey({parentApiKey: 'foo', restrictions: {validUntil: 200}})
client.getSecuredApiKeyRemainingValidity({securedApiKey: resp})
}).not.toThrow();
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ test('sets the ua', () => {
),
});
});

test('forwards node search helpers', () => {
expect(client.generateSecuredApiKey).not.toBeUndefined();
expect(client.getSecuredApiKeyRemainingValidity).not.toBeUndefined();
expect(() => {
const resp = client.generateSecuredApiKey({parentApiKey: 'foo', restrictions: {validUntil: 200}})
client.getSecuredApiKeyRemainingValidity({securedApiKey: resp})
}).not.toThrow();
});
7 changes: 7 additions & 0 deletions playground/javascript/node/algoliasearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ async function testAlgoliasearch() {
],
});

client.generateSecuredApiKey({
parentApiKey: 'foo',
restrictions: {
validUntil: 200,
}
});

const resLite: SearchResponses = await clientLite.search({
requests: [
{
Expand Down

0 comments on commit aa4945c

Please sign in to comment.