-
Notifications
You must be signed in to change notification settings - Fork 496
/
index-es-test.ts
46 lines (38 loc) · 1.25 KB
/
index-es-test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import instantsearch from '../index.es';
describe('instantsearch()', () => {
it('includes a version', () => {
expect(instantsearch.version).toMatch(
/^(\d+\.)?(\d+\.)?(\*|\d+)(-beta.\d+)?$/
);
});
it('does not include the widget functions', () => {
// @ts-expect-error
expect(() => instantsearch.widgets).toThrowErrorMatchingInlineSnapshot(`
"\\"instantsearch.widgets\\" are not available from the ES build.
To import the widgets:
import { searchBox } from 'instantsearch.js/es/widgets'"
`);
});
it('does not include the connectors functions', () => {
// @ts-expect-error
expect(() => instantsearch.connectors).toThrowErrorMatchingInlineSnapshot(`
"\\"instantsearch.connectors\\" are not available from the ES build.
To import the connectors:
import { connectSearchBox } from 'instantsearch.js/es/connectors'"
`);
});
it('includes the helper functions', () => {
expect(Object.keys(instantsearch)).toMatchInlineSnapshot(`
[
"version",
"createInfiniteHitsSessionStorageCache",
"highlight",
"reverseHighlight",
"snippet",
"reverseSnippet",
"insights",
"getInsightsAnonymousUserToken",
]
`);
});
});