UNPKG

@gravity-ui/data-source

Version:
32 lines 911 B
import { composeFullKey } from '../composeFullKey'; import { composeKey } from '../composeKey'; describe('composeFullKey', function () { var dataSource = { name: 'test', fetch: jest.fn() }; var dataSourceWithTags = { name: 'test', fetch: jest.fn(), tags: function tags() { return ['tag1', 'tag2']; } }; it('should compose full key without tags', function () { var params = { id: 1 }; var result = composeFullKey(dataSource, params); var key = composeKey(dataSource, params); expect(result).toEqual(['test', key]); }); it('should compose full key with tags', function () { var params = { id: 1 }; var result = composeFullKey(dataSourceWithTags, params); var key = composeKey(dataSourceWithTags, params); expect(result).toEqual(['test', 'tag1', 'tag2', key]); }); }); // #sourceMappingURL=composeFullKey.test.js.map