Skip to content

Commit d39b877

Browse files
authored
chore: assert node helpers (#3689)
1 parent 2b5b873 commit d39b877

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

clients/algoliasearch-client-javascript/packages/algoliasearch/__tests__/algoliasearch.fetch.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,12 @@ test('sets the ua', () => {
1010
value: expect.stringContaining(`Algolia for JavaScript (${apiClientVersion}); Search (${apiClientVersion}); Fetch`),
1111
});
1212
});
13+
14+
test('forwards node search helpers', () => {
15+
expect(client.generateSecuredApiKey).not.toBeUndefined();
16+
expect(client.getSecuredApiKeyRemainingValidity).not.toBeUndefined();
17+
expect(() => {
18+
const resp = client.generateSecuredApiKey({parentApiKey: 'foo', restrictions: {validUntil: 200}})
19+
client.getSecuredApiKeyRemainingValidity({securedApiKey: resp})
20+
}).not.toThrow();
21+
});

clients/algoliasearch-client-javascript/packages/algoliasearch/__tests__/algoliasearch.node.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,12 @@ test('sets the ua', () => {
1212
),
1313
});
1414
});
15+
16+
test('forwards node search helpers', () => {
17+
expect(client.generateSecuredApiKey).not.toBeUndefined();
18+
expect(client.getSecuredApiKeyRemainingValidity).not.toBeUndefined();
19+
expect(() => {
20+
const resp = client.generateSecuredApiKey({parentApiKey: 'foo', restrictions: {validUntil: 200}})
21+
client.getSecuredApiKeyRemainingValidity({securedApiKey: resp})
22+
}).not.toThrow();
23+
});

playground/javascript/node/algoliasearch.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ async function testAlgoliasearch() {
3232
],
3333
});
3434

35+
client.generateSecuredApiKey({
36+
parentApiKey: 'foo',
37+
restrictions: {
38+
validUntil: 200,
39+
}
40+
});
41+
3542
const resLite: SearchResponses = await clientLite.search({
3643
requests: [
3744
{

0 commit comments

Comments
 (0)