1 | import getOptions from './getOptions';
|
2 | import {
|
3 | getSafelyForAutoComplete,
|
4 | getSafelyForAutoCompleteWithProjection,
|
5 | } from '.';
|
6 |
|
7 | jest.mock('./getOptions', () => jest.fn());
|
8 |
|
9 | describe('getForAutoComplete', () => {
|
10 | it('should have been called with projection-based URL', () => {
|
11 | getSafelyForAutoComplete('/foo', 'key', 'path')('bar');
|
12 | expect(getOptions).toHaveBeenCalledWith(
|
13 | '/foo?search=bar',
|
14 | 'key',
|
15 | 'path',
|
16 | );
|
17 | });
|
18 |
|
19 | it('should have been called with projection-based URL', () => {
|
20 | getSafelyForAutoCompleteWithProjection(
|
21 | '/foo?fields=id,key',
|
22 | 'key',
|
23 | 'path',
|
24 | )('bar');
|
25 | expect(getOptions).toHaveBeenCalledWith(
|
26 | '/foo?fields=id,key&search=bar',
|
27 | 'key',
|
28 | 'path',
|
29 | );
|
30 | });
|
31 | });
|