Skip to content

Commit 1bb205a

Browse files
algolia-botmillotp
andcommitted
fix(cts): add e2e tests for composition api [skip-bc] (#4111) (generated) [skip ci]
Co-authored-by: Pierre Millot <[email protected]>
1 parent 4ec0c4c commit 1bb205a

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// 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.
2+
import { describe, expect, test } from 'vitest';
3+
4+
import { union } from '../helpers.js';
5+
6+
import { compositionClient } from '@algolia/client-composition';
7+
import * as dotenv from 'dotenv';
8+
9+
dotenv.config({ path: '../../.env' });
10+
11+
if (!process.env.METIS_APPLICATION_ID) {
12+
throw new Error('please provide an `METIS_APPLICATION_ID` env var for e2e tests');
13+
}
14+
15+
if (!process.env.METIS_API_KEY) {
16+
throw new Error('please provide an `METIS_API_KEY` env var for e2e tests');
17+
}
18+
19+
const client = compositionClient(process.env.METIS_APPLICATION_ID, process.env.METIS_API_KEY);
20+
21+
describe('listCompositions', () => {
22+
test('listCompositions', async () => {
23+
const resp = await client.listCompositions();
24+
25+
const expectedBody = {
26+
items: [
27+
{
28+
objectID: 'id1',
29+
description: 'the first ever composition from the client',
30+
behavior: { injection: { main: { source: { search: { index: 'cts_e2e_small' } } } } },
31+
},
32+
],
33+
nbPages: 1,
34+
};
35+
36+
expect(expectedBody).toEqual(union(expectedBody, resp));
37+
});
38+
});

0 commit comments

Comments
 (0)