UNPKG

790 BJavaScriptView Raw
1import getOptions from './getOptions';
2import {
3 getSafelyForAutoComplete,
4 getSafelyForAutoCompleteWithProjection,
5} from '.';
6
7jest.mock('./getOptions', () => jest.fn());
8
9describe('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});