UNPKG

@gravity-ui/data-source

Version:
49 lines (48 loc) 1.28 kB
"use strict"; var _getStatus = require("../getStatus"); describe('getStatus', function () { it('should return success when all statuses are success', function () { var states = [{ status: 'success' }, { status: 'success' }, { status: 'success' }]; expect((0, _getStatus.getStatus)(states)).toBe('success'); }); it('should return loading when at least one status is loading', function () { var states = [{ status: 'success' }, { status: 'loading' }, { status: 'success' }]; expect((0, _getStatus.getStatus)(states)).toBe('loading'); }); it('should return error when at least one status is error', function () { var states = [{ status: 'success' }, { status: 'error' }, { status: 'success' }]; expect((0, _getStatus.getStatus)(states)).toBe('error'); }); it('should prioritize error over loading', function () { var states = [{ status: 'loading' }, { status: 'error' }, { status: 'success' }]; expect((0, _getStatus.getStatus)(states)).toBe('error'); }); it('should handle empty array', function () { expect((0, _getStatus.getStatus)([])).toBe('success'); }); }); // #sourceMappingURL=getStatus.test.js.map