Skip to content

Commit 680c2f9

Browse files
authored
test(chat): add and move tests to the CTS (#6752)
1 parent 3fd11fc commit 680c2f9

File tree

7 files changed

+941
-355
lines changed

7 files changed

+941
-355
lines changed

packages/instantsearch.js/src/widgets/chat/__tests__/chat.test.tsx

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*/
44
/** @jsx h */
55
import { createSearchClient } from '@instantsearch/mocks';
6-
import { wait } from '@instantsearch/testutils';
7-
import userEvent from '@testing-library/user-event';
86

97
import instantsearch from '../../../index.es';
108
import chat from '../chat';
@@ -29,32 +27,5 @@ describe('chat', () => {
2927
See documentation: https://www.algolia.com/doc/api-reference/widgets/chat/js/"
3028
`);
3129
});
32-
33-
test('adds custom CSS classes', async () => {
34-
const container = document.createElement('div');
35-
const searchClient = createSearchClient();
36-
37-
const search = instantsearch({ indexName: 'indexName', searchClient });
38-
const widget = chat({
39-
container,
40-
agentId: 'agentId',
41-
cssClasses: {
42-
root: 'ROOT',
43-
container: 'CONTAINER',
44-
},
45-
});
46-
47-
search.addWidgets([widget]);
48-
search.start();
49-
await wait(0);
50-
51-
userEvent.click(container.querySelector('.ais-ChatToggleButton')!);
52-
await wait(0);
53-
54-
expect(container.querySelector('.ais-Chat')).toHaveClass('ROOT');
55-
expect(container.querySelector('.ais-Chat-container')).toHaveClass(
56-
'CONTAINER'
57-
);
58-
});
5930
});
6031
});

packages/react-instantsearch/src/widgets/__tests__/Chat.test.tsx

Lines changed: 0 additions & 160 deletions
This file was deleted.

tests/common/widgets/chat/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { fakeAct, skippableDescribe } from '../../common';
22

33
import { createOptionsTests } from './options';
4+
import { createTemplatesTests } from './templates';
5+
import { createTranslationsTests } from './translations';
46

57
import type { TestOptions, TestSetup } from '../../common';
68
import type { ChatConnectorParams } from 'instantsearch.js/es/connectors/chat/connectChat';
@@ -39,11 +41,9 @@ export function createChatWidgetTests(
3941
});
4042

4143
skippableDescribe('Chat widget common tests', skippedTests, () => {
42-
createOptionsTests(setup, {
43-
act,
44-
skippedTests,
45-
flavor,
46-
});
44+
createOptionsTests(setup, { act, skippedTests, flavor });
45+
createTemplatesTests(setup, { act, skippedTests, flavor });
46+
createTranslationsTests(setup, { act, skippedTests, flavor });
4747
});
4848
}
4949
createChatWidgetTests.flavored = true;

0 commit comments

Comments
 (0)