@gravity-ui/data-source
Version:
A wrapper around data fetching
34 lines (33 loc) • 1 kB
JavaScript
;
var _composeFullKey = require("../composeFullKey");
var _composeKey = require("../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 = (0, _composeFullKey.composeFullKey)(dataSource, params);
var key = (0, _composeKey.composeKey)(dataSource, params);
expect(result).toEqual(['test', key]);
});
it('should compose full key with tags', function () {
var params = {
id: 1
};
var result = (0, _composeFullKey.composeFullKey)(dataSourceWithTags, params);
var key = (0, _composeKey.composeKey)(dataSourceWithTags, params);
expect(result).toEqual(['test', 'tag1', 'tag2', key]);
});
});
// #sourceMappingURL=composeFullKey.test.js.map