Skip to content

Commit af987f4

Browse files
algolia-botshortcutsmillotp
committed
fix(javascript): common package types (#4015) (generated) [skip ci]
Co-authored-by: Clément Vannicatte <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 25de700 commit af987f4

27 files changed

+388
-112
lines changed

tests/output/javascript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "javascript-tests",
3+
"type": "module",
34
"version": "1.0.0",
45
"scripts": {
56
"test": "tsc --noEmit && vitest run"
67
},
78
"dependencies": {
8-
"@algolia/client-common": "link:../../../clients/algoliasearch-client-javascript/packages/client-common",
99
"@algolia/requester-testing": "link:../../../clients/algoliasearch-client-javascript/packages/requester-testing",
1010
"algoliasearch": "link:../../../clients/algoliasearch-client-javascript/packages/algoliasearch"
1111
},

tests/output/javascript/src/benchmark/search.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ import { algoliasearch } from 'algoliasearch';
66
describe('benchmark', () => {
77
test('benchmark the search method', async () => {
88
const client = algoliasearch('test-app-id', 'test-api-key', {
9-
hosts: [{ url: 'localhost', port: 6682, accept: 'readWrite', protocol: 'http' }],
9+
hosts: [
10+
{
11+
url: 'localhost',
12+
port: 6682,
13+
accept: 'readWrite',
14+
protocol: 'http',
15+
},
16+
],
1017
});
1118

1219
for (let i = 0; i < 2000; i++) {

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

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
22
/* eslint-disable eslint/no-unused-vars */
3-
// @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 { describe, expect, test } from 'vitest';
54

65
import type { EchoResponse } from '@algolia/requester-testing';
@@ -53,30 +52,38 @@ describe('commonApi', () => {
5352
describe('parameters', () => {
5453
test('fallbacks to the alias when region is not given', async () => {
5554
const client = algoliasearch('my-app-id', 'my-api-key').initAbtesting({
56-
options: { requester: nodeEchoRequester() },
55+
options: {
56+
requester: nodeEchoRequester(),
57+
},
58+
// @ts-ignore
5759
region: '',
5860
});
59-
6061
const result = (await client.getABTest({ id: 123 })) as unknown as EchoResponse;
6162

6263
expect(result.host).toEqual('analytics.algolia.com');
6364
}, 15000);
6465

6566
test('uses the correct region', async () => {
6667
const client = algoliasearch('my-app-id', 'my-api-key').initAbtesting({
67-
options: { requester: nodeEchoRequester() },
68+
options: {
69+
requester: nodeEchoRequester(),
70+
},
71+
// @ts-ignore
6872
region: 'us',
6973
});
70-
7174
const result = (await client.getABTest({ id: 123 })) as unknown as EchoResponse;
7275

7376
expect(result.host).toEqual('analytics.us.algolia.com');
7477
}, 15000);
7578

7679
test('throws when incorrect region is given', async () => {
7780
try {
81+
// @ts-ignore
7882
const client = algoliasearch('my-app-id', 'my-api-key').initAbtesting({
79-
options: { requester: nodeEchoRequester() },
83+
options: {
84+
requester: nodeEchoRequester(),
85+
},
86+
// @ts-ignore
8087
region: 'not_a_region',
8188
});
8289
throw new Error('test is expected to throw error');
@@ -89,10 +96,19 @@ describe('parameters', () => {
8996
describe('setClientApiKey', () => {
9097
test('switch API key', async () => {
9198
const client = algoliasearch('test-app-id', 'test-api-key').initAbtesting({
92-
options: { hosts: [{ url: 'localhost', port: 6683, accept: 'readWrite', protocol: 'http' }] },
99+
options: {
100+
hosts: [
101+
{
102+
url: 'localhost',
103+
port: 6683,
104+
accept: 'readWrite',
105+
protocol: 'http',
106+
},
107+
],
108+
},
109+
// @ts-ignore
93110
region: 'us',
94111
});
95-
96112
{
97113
const result = await client.customGet({ path: 'check-api-key/1' });
98114

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

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
22
/* eslint-disable eslint/no-unused-vars */
3-
// @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 { describe, expect, test } from 'vitest';
54

65
import type { EchoResponse } from '@algolia/requester-testing';
@@ -53,30 +52,38 @@ describe('commonApi', () => {
5352
describe('parameters', () => {
5453
test('fallbacks to the alias when region is not given', async () => {
5554
const client = algoliasearch('my-app-id', 'my-api-key').initAnalytics({
56-
options: { requester: nodeEchoRequester() },
55+
options: {
56+
requester: nodeEchoRequester(),
57+
},
58+
// @ts-ignore
5759
region: '',
5860
});
59-
6061
const result = (await client.getAverageClickPosition({ index: 'my-index' })) as unknown as EchoResponse;
6162

6263
expect(result.host).toEqual('analytics.algolia.com');
6364
}, 15000);
6465

6566
test('uses the correct region', async () => {
6667
const client = algoliasearch('my-app-id', 'my-api-key').initAnalytics({
67-
options: { requester: nodeEchoRequester() },
68+
options: {
69+
requester: nodeEchoRequester(),
70+
},
71+
// @ts-ignore
6872
region: 'de',
6973
});
70-
7174
const result = (await client.customPost({ path: 'test' })) as unknown as EchoResponse;
7275

7376
expect(result.host).toEqual('analytics.de.algolia.com');
7477
}, 15000);
7578

7679
test('throws when incorrect region is given', async () => {
7780
try {
81+
// @ts-ignore
7882
const client = algoliasearch('my-app-id', 'my-api-key').initAnalytics({
79-
options: { requester: nodeEchoRequester() },
83+
options: {
84+
requester: nodeEchoRequester(),
85+
},
86+
// @ts-ignore
8087
region: 'not_a_region',
8188
});
8289
throw new Error('test is expected to throw error');
@@ -89,6 +96,7 @@ describe('parameters', () => {
8996
const client = createClient();
9097

9198
try {
99+
// @ts-ignore
92100
const result = (await client.getClickPositions({})) as unknown as EchoResponse;
93101
throw new Error('test is expected to throw error');
94102
} catch (e) {
@@ -100,10 +108,19 @@ describe('parameters', () => {
100108
describe('setClientApiKey', () => {
101109
test('switch API key', async () => {
102110
const client = algoliasearch('test-app-id', 'test-api-key').initAnalytics({
103-
options: { hosts: [{ url: 'localhost', port: 6683, accept: 'readWrite', protocol: 'http' }] },
111+
options: {
112+
hosts: [
113+
{
114+
url: 'localhost',
115+
port: 6683,
116+
accept: 'readWrite',
117+
protocol: 'http',
118+
},
119+
],
120+
},
121+
// @ts-ignore
104122
region: 'us',
105123
});
106-
107124
{
108125
const result = await client.customGet({ path: 'check-api-key/1' });
109126

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

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
22
/* eslint-disable eslint/no-unused-vars */
3-
// @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 { describe, expect, test } from 'vitest';
54

65
import type { EchoResponse } from '@algolia/requester-testing';
@@ -53,10 +52,12 @@ describe('commonApi', () => {
5352
describe('parameters', () => {
5453
test('uses the correct region', async () => {
5554
const client = algoliasearch('my-app-id', 'my-api-key').initIngestion({
56-
options: { requester: nodeEchoRequester() },
55+
options: {
56+
requester: nodeEchoRequester(),
57+
},
58+
// @ts-ignore
5759
region: 'us',
5860
});
59-
6061
const result = (await client.getSource({
6162
sourceID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
6263
})) as unknown as EchoResponse;
@@ -66,8 +67,12 @@ describe('parameters', () => {
6667

6768
test('throws when incorrect region is given', async () => {
6869
try {
70+
// @ts-ignore
6971
const client = algoliasearch('my-app-id', 'my-api-key').initIngestion({
70-
options: { requester: nodeEchoRequester() },
72+
options: {
73+
requester: nodeEchoRequester(),
74+
},
75+
// @ts-ignore
7176
region: 'not_a_region',
7277
});
7378
throw new Error('test is expected to throw error');
@@ -80,10 +85,19 @@ describe('parameters', () => {
8085
describe('setClientApiKey', () => {
8186
test('switch API key', async () => {
8287
const client = algoliasearch('test-app-id', 'test-api-key').initIngestion({
83-
options: { hosts: [{ url: 'localhost', port: 6683, accept: 'readWrite', protocol: 'http' }] },
88+
options: {
89+
hosts: [
90+
{
91+
url: 'localhost',
92+
port: 6683,
93+
accept: 'readWrite',
94+
protocol: 'http',
95+
},
96+
],
97+
},
98+
// @ts-ignore
8499
region: 'us',
85100
});
86-
87101
{
88102
const result = await client.customGet({ path: 'check-api-key/1' });
89103

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

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
22
/* eslint-disable eslint/no-unused-vars */
3-
// @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 { describe, expect, test } from 'vitest';
54

65
import type { EchoResponse } from '@algolia/requester-testing';
@@ -53,10 +52,12 @@ describe('commonApi', () => {
5352
describe('parameters', () => {
5453
test('fallbacks to the alias when region is not given', async () => {
5554
const client = algoliasearch('my-app-id', 'my-api-key').initInsights({
56-
options: { requester: nodeEchoRequester() },
55+
options: {
56+
requester: nodeEchoRequester(),
57+
},
58+
// @ts-ignore
5759
region: '',
5860
});
59-
6061
const result = (await client.pushEvents({
6162
events: [
6263
{
@@ -78,19 +79,25 @@ describe('parameters', () => {
7879

7980
test('uses the correct region', async () => {
8081
const client = algoliasearch('my-app-id', 'my-api-key').initInsights({
81-
options: { requester: nodeEchoRequester() },
82+
options: {
83+
requester: nodeEchoRequester(),
84+
},
85+
// @ts-ignore
8286
region: 'us',
8387
});
84-
8588
const result = (await client.customDelete({ path: 'test' })) as unknown as EchoResponse;
8689

8790
expect(result.host).toEqual('insights.us.algolia.io');
8891
}, 15000);
8992

9093
test('throws when incorrect region is given', async () => {
9194
try {
95+
// @ts-ignore
9296
const client = algoliasearch('my-app-id', 'my-api-key').initInsights({
93-
options: { requester: nodeEchoRequester() },
97+
options: {
98+
requester: nodeEchoRequester(),
99+
},
100+
// @ts-ignore
94101
region: 'not_a_region',
95102
});
96103
throw new Error('test is expected to throw error');
@@ -103,10 +110,19 @@ describe('parameters', () => {
103110
describe('setClientApiKey', () => {
104111
test('switch API key', async () => {
105112
const client = algoliasearch('test-app-id', 'test-api-key').initInsights({
106-
options: { hosts: [{ url: 'localhost', port: 6683, accept: 'readWrite', protocol: 'http' }] },
113+
options: {
114+
hosts: [
115+
{
116+
url: 'localhost',
117+
port: 6683,
118+
accept: 'readWrite',
119+
protocol: 'http',
120+
},
121+
],
122+
},
123+
// @ts-ignore
107124
region: 'us',
108125
});
109-
110126
{
111127
const result = await client.customGet({ path: 'check-api-key/1' });
112128

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
22
/* eslint-disable eslint/no-unused-vars */
3-
// @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 { describe, expect, test } from 'vitest';
54

65
import type { EchoResponse } from '@algolia/requester-testing';
@@ -53,9 +52,10 @@ describe('commonApi', () => {
5352
describe('parameters', () => {
5453
test('use the correct host', async () => {
5554
const client = algoliasearch('my-app-id', 'my-api-key').initMonitoring({
56-
options: { requester: nodeEchoRequester() },
55+
options: {
56+
requester: nodeEchoRequester(),
57+
},
5758
});
58-
5959
const result = (await client.customDelete({ path: 'test' })) as unknown as EchoResponse;
6060

6161
expect(result.host).toEqual('status.algolia.com');
@@ -65,9 +65,17 @@ describe('parameters', () => {
6565
describe('setClientApiKey', () => {
6666
test('switch API key', async () => {
6767
const client = algoliasearch('test-app-id', 'test-api-key').initMonitoring({
68-
options: { hosts: [{ url: 'localhost', port: 6683, accept: 'readWrite', protocol: 'http' }] },
68+
options: {
69+
hosts: [
70+
{
71+
url: 'localhost',
72+
port: 6683,
73+
accept: 'readWrite',
74+
protocol: 'http',
75+
},
76+
],
77+
},
6978
});
70-
7179
{
7280
const result = await client.customGet({ path: 'check-api-key/1' });
7381

0 commit comments

Comments
 (0)