Skip to content

Commit d12a218

Browse files
chore: generated code for commit faba721. [skip ci]
Co-authored-by: Clément Vannicatte <[email protected]>
1 parent faba721 commit d12a218

File tree

9 files changed

+109
-56
lines changed

9 files changed

+109
-56
lines changed

tests/output/javascript/src/client/abtesting.test.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import type { AbtestingClient } from '@experimental-api-clients-automation/client-abtesting';
33
import { abtestingClient } from '@experimental-api-clients-automation/client-abtesting';
44
import { echoRequester } from '@experimental-api-clients-automation/requester-node-http';
5+
import type { EchoResponse } from '@experimental-api-clients-automation/requester-node-http';
56

67
const appId = 'test-app-id';
78
const apiKey = 'test-api-key';
@@ -14,7 +15,9 @@ describe('commonApi', () => {
1415
test('calls api with correct user agent', async () => {
1516
const $client = createClient();
1617

17-
const result = await $client.post({ path: '/test' });
18+
const result = (await $client.post({
19+
path: '/test',
20+
})) as unknown as EchoResponse;
1821

1922
expect(decodeURI(result.algoliaAgent)).toMatch(
2023
/^Algolia for JavaScript \(\d+\.\d+\.\d+(-.*)?\)(; [a-zA-Z. ]+ (\(\d+\.\d+\.\d+(-.*)?\))?)*(; Abtesting (\(\d+\.\d+\.\d+(-.*)?\)))(; [a-zA-Z. ]+ (\(\d+\.\d+\.\d+(-.*)?\))?)*$/
@@ -24,7 +27,9 @@ describe('commonApi', () => {
2427
test('calls api with correct timeouts', async () => {
2528
const $client = createClient();
2629

27-
const result = await $client.post({ path: '/test' });
30+
const result = (await $client.post({
31+
path: '/test',
32+
})) as unknown as EchoResponse;
2833

2934
expect(result).toEqual(
3035
expect.objectContaining({ connectTimeout: 2000, responseTimeout: 30000 })
@@ -38,7 +43,9 @@ describe('parameters', () => {
3843
requester: echoRequester(),
3944
});
4045

41-
const result = await $client.getABTest({ id: 123 });
46+
const result = (await $client.getABTest({
47+
id: 123,
48+
})) as unknown as EchoResponse;
4249

4350
expect(result.host).toEqual('analytics.algolia.com');
4451
});

tests/output/javascript/src/client/analytics.test.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-disable @typescript-eslint/no-unused-vars */
2-
32
// @ts-nocheck Failing tests will have type errors, but we cannot suppress them even with @ts-expect-error because it doesn't work for a block of lines.
43
import type { AnalyticsClient } from '@experimental-api-clients-automation/client-analytics';
54
import { analyticsClient } from '@experimental-api-clients-automation/client-analytics';
65
import { echoRequester } from '@experimental-api-clients-automation/requester-node-http';
6+
import type { EchoResponse } from '@experimental-api-clients-automation/requester-node-http';
77

88
const appId = 'test-app-id';
99
const apiKey = 'test-api-key';
@@ -16,7 +16,9 @@ describe('commonApi', () => {
1616
test('calls api with correct user agent', async () => {
1717
const $client = createClient();
1818

19-
const result = await $client.post({ path: '/test' });
19+
const result = (await $client.post({
20+
path: '/test',
21+
})) as unknown as EchoResponse;
2022

2123
expect(decodeURI(result.algoliaAgent)).toMatch(
2224
/^Algolia for JavaScript \(\d+\.\d+\.\d+(-.*)?\)(; [a-zA-Z. ]+ (\(\d+\.\d+\.\d+(-.*)?\))?)*(; Analytics (\(\d+\.\d+\.\d+(-.*)?\)))(; [a-zA-Z. ]+ (\(\d+\.\d+\.\d+(-.*)?\))?)*$/
@@ -26,7 +28,9 @@ describe('commonApi', () => {
2628
test('calls api with correct timeouts', async () => {
2729
const $client = createClient();
2830

29-
const result = await $client.post({ path: '/test' });
31+
const result = (await $client.post({
32+
path: '/test',
33+
})) as unknown as EchoResponse;
3034

3135
expect(result).toEqual(
3236
expect.objectContaining({ connectTimeout: 2000, responseTimeout: 30000 })
@@ -40,7 +44,9 @@ describe('parameters', () => {
4044
requester: echoRequester(),
4145
});
4246

43-
const result = await $client.getAverageClickPosition({ index: 'my-index' });
47+
const result = (await $client.getAverageClickPosition({
48+
index: 'my-index',
49+
})) as unknown as EchoResponse;
4450

4551
expect(result.host).toEqual('analytics.algolia.com');
4652
});
@@ -49,11 +55,13 @@ describe('parameters', () => {
4955
const $client = createClient();
5056

5157
try {
52-
const result = await $client.getClickPositions({});
58+
const result = (await $client.getClickPositions(
59+
{}
60+
)) as unknown as EchoResponse;
5361

5462
throw new Error('test is expected to throw error');
5563
} catch (e) {
56-
expect(e.message).toMatch(
64+
expect((e as Error).message).toMatch(
5765
'Parameter `index` is required when calling `getClickPositions`.'
5866
);
5967
}

tests/output/javascript/src/client/insights.test.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import type { InsightsClient } from '@experimental-api-clients-automation/client-insights';
33
import { insightsClient } from '@experimental-api-clients-automation/client-insights';
44
import { echoRequester } from '@experimental-api-clients-automation/requester-node-http';
5+
import type { EchoResponse } from '@experimental-api-clients-automation/requester-node-http';
56

67
const appId = 'test-app-id';
78
const apiKey = 'test-api-key';
@@ -14,7 +15,9 @@ describe('commonApi', () => {
1415
test('calls api with correct user agent', async () => {
1516
const $client = createClient();
1617

17-
const result = await $client.post({ path: '/test' });
18+
const result = (await $client.post({
19+
path: '/test',
20+
})) as unknown as EchoResponse;
1821

1922
expect(decodeURI(result.algoliaAgent)).toMatch(
2023
/^Algolia for JavaScript \(\d+\.\d+\.\d+(-.*)?\)(; [a-zA-Z. ]+ (\(\d+\.\d+\.\d+(-.*)?\))?)*(; Insights (\(\d+\.\d+\.\d+(-.*)?\)))(; [a-zA-Z. ]+ (\(\d+\.\d+\.\d+(-.*)?\))?)*$/
@@ -24,7 +27,9 @@ describe('commonApi', () => {
2427
test('calls api with correct timeouts', async () => {
2528
const $client = createClient();
2629

27-
const result = await $client.post({ path: '/test' });
30+
const result = (await $client.post({
31+
path: '/test',
32+
})) as unknown as EchoResponse;
2833

2934
expect(result).toEqual(
3035
expect.objectContaining({ connectTimeout: 2000, responseTimeout: 30000 })
@@ -38,7 +43,9 @@ describe('parameters', () => {
3843
requester: echoRequester(),
3944
});
4045

41-
const result = await $client.pushEvents({ events: [] });
46+
const result = (await $client.pushEvents({
47+
events: [],
48+
})) as unknown as EchoResponse;
4249

4350
expect(result.host).toEqual('insights.algolia.io');
4451
});

tests/output/javascript/src/client/personalization.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/* eslint-disable @typescript-eslint/no-unused-vars */
2-
/* eslint-disable require-await */
1+
/* eslint-disable @typescript-eslint/no-unused-vars, require-await */
32
// @ts-nocheck Failing tests will have type errors, but we cannot suppress them even with @ts-expect-error because it doesn't work for a block of lines.
43
import type { PersonalizationClient } from '@experimental-api-clients-automation/client-personalization';
54
import { personalizationClient } from '@experimental-api-clients-automation/client-personalization';
65
import { echoRequester } from '@experimental-api-clients-automation/requester-node-http';
6+
import type { EchoResponse } from '@experimental-api-clients-automation/requester-node-http';
77

88
const appId = 'test-app-id';
99
const apiKey = 'test-api-key';
@@ -18,7 +18,9 @@ describe('commonApi', () => {
1818
test('calls api with correct user agent', async () => {
1919
const $client = createClient();
2020

21-
const result = await $client.post({ path: '/test' });
21+
const result = (await $client.post({
22+
path: '/test',
23+
})) as unknown as EchoResponse;
2224

2325
expect(decodeURI(result.algoliaAgent)).toMatch(
2426
/^Algolia for JavaScript \(\d+\.\d+\.\d+(-.*)?\)(; [a-zA-Z. ]+ (\(\d+\.\d+\.\d+(-.*)?\))?)*(; Personalization (\(\d+\.\d+\.\d+(-.*)?\)))(; [a-zA-Z. ]+ (\(\d+\.\d+\.\d+(-.*)?\))?)*$/
@@ -28,7 +30,9 @@ describe('commonApi', () => {
2830
test('calls api with correct timeouts', async () => {
2931
const $client = createClient();
3032

31-
const result = await $client.post({ path: '/test' });
33+
const result = (await $client.post({
34+
path: '/test',
35+
})) as unknown as EchoResponse;
3236

3337
expect(result).toEqual(
3438
expect.objectContaining({ connectTimeout: 2000, responseTimeout: 30000 })
@@ -48,7 +52,7 @@ describe('parameters', () => {
4852

4953
throw new Error('test is expected to throw error');
5054
} catch (e) {
51-
expect(e.message).toMatch(
55+
expect((e as Error).message).toMatch(
5256
'`region` must be one of the following: eu, us'
5357
);
5458
}

tests/output/javascript/src/client/predict.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/* eslint-disable @typescript-eslint/no-unused-vars */
2-
/* eslint-disable require-await */
1+
/* eslint-disable @typescript-eslint/no-unused-vars, require-await */
32
// @ts-nocheck Failing tests will have type errors, but we cannot suppress them even with @ts-expect-error because it doesn't work for a block of lines.
43
import type { PredictClient } from '@experimental-api-clients-automation/client-predict';
54
import { predictClient } from '@experimental-api-clients-automation/client-predict';
65
import { echoRequester } from '@experimental-api-clients-automation/requester-node-http';
6+
import type { EchoResponse } from '@experimental-api-clients-automation/requester-node-http';
77

88
const appId = 'test-app-id';
99
const apiKey = 'test-api-key';
@@ -16,7 +16,9 @@ describe('commonApi', () => {
1616
test('calls api with correct user agent', async () => {
1717
const $client = createClient();
1818

19-
const result = await $client.post({ path: '/test' });
19+
const result = (await $client.post({
20+
path: '/test',
21+
})) as unknown as EchoResponse;
2022

2123
expect(decodeURI(result.algoliaAgent)).toMatch(
2224
/^Algolia for JavaScript \(\d+\.\d+\.\d+(-.*)?\)(; [a-zA-Z. ]+ (\(\d+\.\d+\.\d+(-.*)?\))?)*(; Predict (\(\d+\.\d+\.\d+(-.*)?\)))(; [a-zA-Z. ]+ (\(\d+\.\d+\.\d+(-.*)?\))?)*$/
@@ -26,7 +28,9 @@ describe('commonApi', () => {
2628
test('calls api with correct timeouts', async () => {
2729
const $client = createClient();
2830

29-
const result = await $client.post({ path: '/test' });
31+
const result = (await $client.post({
32+
path: '/test',
33+
})) as unknown as EchoResponse;
3034

3135
expect(result).toEqual(
3236
expect.objectContaining({ connectTimeout: 2000, responseTimeout: 30000 })
@@ -43,7 +47,7 @@ describe('parameters', () => {
4347

4448
throw new Error('test is expected to throw error');
4549
} catch (e) {
46-
expect(e.message).toMatch(
50+
expect((e as Error).message).toMatch(
4751
'`region` must be one of the following: ue, ew'
4852
);
4953
}

tests/output/javascript/src/client/query-suggestions.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/* eslint-disable @typescript-eslint/no-unused-vars */
2-
/* eslint-disable require-await */
1+
/* eslint-disable @typescript-eslint/no-unused-vars, require-await */
32
// @ts-nocheck Failing tests will have type errors, but we cannot suppress them even with @ts-expect-error because it doesn't work for a block of lines.
43
import type { QuerySuggestionsClient } from '@experimental-api-clients-automation/client-query-suggestions';
54
import { querySuggestionsClient } from '@experimental-api-clients-automation/client-query-suggestions';
65
import { echoRequester } from '@experimental-api-clients-automation/requester-node-http';
6+
import type { EchoResponse } from '@experimental-api-clients-automation/requester-node-http';
77

88
const appId = 'test-app-id';
99
const apiKey = 'test-api-key';
@@ -18,7 +18,9 @@ describe('commonApi', () => {
1818
test('calls api with correct user agent', async () => {
1919
const $client = createClient();
2020

21-
const result = await $client.post({ path: '/test' });
21+
const result = (await $client.post({
22+
path: '/test',
23+
})) as unknown as EchoResponse;
2224

2325
expect(decodeURI(result.algoliaAgent)).toMatch(
2426
/^Algolia for JavaScript \(\d+\.\d+\.\d+(-.*)?\)(; [a-zA-Z. ]+ (\(\d+\.\d+\.\d+(-.*)?\))?)*(; QuerySuggestions (\(\d+\.\d+\.\d+(-.*)?\)))(; [a-zA-Z. ]+ (\(\d+\.\d+\.\d+(-.*)?\))?)*$/
@@ -28,7 +30,9 @@ describe('commonApi', () => {
2830
test('calls api with correct timeouts', async () => {
2931
const $client = createClient();
3032

31-
const result = await $client.post({ path: '/test' });
33+
const result = (await $client.post({
34+
path: '/test',
35+
})) as unknown as EchoResponse;
3236

3337
expect(result).toEqual(
3438
expect.objectContaining({ connectTimeout: 2000, responseTimeout: 30000 })
@@ -48,7 +52,7 @@ describe('parameters', () => {
4852

4953
throw new Error('test is expected to throw error');
5054
} catch (e) {
51-
expect(e.message).toMatch(
55+
expect((e as Error).message).toMatch(
5256
'`region` must be one of the following: eu, us'
5357
);
5458
}

tests/output/javascript/src/client/recommend.test.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import type { RecommendClient } from '@experimental-api-clients-automation/recommend';
33
import { recommendClient } from '@experimental-api-clients-automation/recommend';
44
import { echoRequester } from '@experimental-api-clients-automation/requester-node-http';
5+
import type { EchoResponse } from '@experimental-api-clients-automation/requester-node-http';
56

67
const appId = 'test-app-id';
78
const apiKey = 'test-api-key';
@@ -16,7 +17,9 @@ describe('api', () => {
1617
requester: echoRequester(),
1718
});
1819

19-
const result = await $client.get({ path: '/test' });
20+
const result = (await $client.get({
21+
path: '/test',
22+
})) as unknown as EchoResponse;
2023

2124
expect(result.host).toEqual('test-app-id-dsn.algolia.net');
2225
});
@@ -26,7 +29,9 @@ describe('commonApi', () => {
2629
test('calls api with correct user agent', async () => {
2730
const $client = createClient();
2831

29-
const result = await $client.post({ path: '/test' });
32+
const result = (await $client.post({
33+
path: '/test',
34+
})) as unknown as EchoResponse;
3035

3136
expect(decodeURI(result.algoliaAgent)).toMatch(
3237
/^Algolia for JavaScript \(\d+\.\d+\.\d+(-.*)?\)(; [a-zA-Z. ]+ (\(\d+\.\d+\.\d+(-.*)?\))?)*(; Recommend (\(\d+\.\d+\.\d+(-.*)?\)))(; [a-zA-Z. ]+ (\(\d+\.\d+\.\d+(-.*)?\))?)*$/
@@ -36,7 +41,9 @@ describe('commonApi', () => {
3641
test('calls api with correct timeouts', async () => {
3742
const $client = createClient();
3843

39-
const result = await $client.post({ path: '/test' });
44+
const result = (await $client.post({
45+
path: '/test',
46+
})) as unknown as EchoResponse;
4047

4148
expect(result).toEqual(
4249
expect.objectContaining({ connectTimeout: 2000, responseTimeout: 30000 })

0 commit comments

Comments
 (0)