@gravity-ui/data-source
Version:
A wrapper around data fetching
25 lines (24 loc) • 1.09 kB
JavaScript
;
var _mergeStatuses = require("../mergeStatuses");
describe('mergeStatuses', function () {
it('should return success when all statuses are success', function () {
var statuses = ['success', 'success', 'success'];
expect((0, _mergeStatuses.mergeStatuses)(statuses)).toBe('success');
});
it('should return loading when at least one status is loading', function () {
var statuses = ['success', 'loading', 'success'];
expect((0, _mergeStatuses.mergeStatuses)(statuses)).toBe('loading');
});
it('should return error when at least one status is error', function () {
var statuses = ['success', 'error', 'success'];
expect((0, _mergeStatuses.mergeStatuses)(statuses)).toBe('error');
});
it('should prioritize error over loading', function () {
var statuses = ['loading', 'error', 'success'];
expect((0, _mergeStatuses.mergeStatuses)(statuses)).toBe('error');
});
it('should handle empty array', function () {
expect((0, _mergeStatuses.mergeStatuses)([])).toBe('success');
});
});
// #sourceMappingURL=mergeStatuses.test.js.map