UNPKG

@gravity-ui/data-source

Version:
47 lines 1.19 kB
import { getStatus } from '../getStatus'; describe('getStatus', function () { it('should return success when all statuses are success', function () { var states = [{ status: 'success' }, { status: 'success' }, { status: 'success' }]; expect(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(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(getStatus(states)).toBe('error'); }); it('should prioritize error over loading', function () { var states = [{ status: 'loading' }, { status: 'error' }, { status: 'success' }]; expect(getStatus(states)).toBe('error'); }); it('should handle empty array', function () { expect(getStatus([])).toBe('success'); }); }); // #sourceMappingURL=getStatus.test.js.map