MCPcopy Create free account
hub / github.com/angular/angular / throwStatusAndErrors

Function throwStatusAndErrors

packages/core/test/resource/params_status_spec.ts:13–20  ·  view source on GitHub ↗
(source: () => T | ResourceParamsStatus | Error)

Source from the content-addressed store, hash-verified

11import {TestBed} from '../../testing';
12
13function throwStatusAndErrors<T>(source: () => T | ResourceParamsStatus | Error): () => T {
14 return () => {
15 const value = source();
16 if (value instanceof Error) throw value;
17 if (value === ResourceParamsStatus.IDLE || value === ResourceParamsStatus.LOADING) throw value;
18 return value as T;
19 };
20}
21
22describe('resource with ResourceParamsStatus', () => {
23 it('should transition to idle when params throws ResourceParamsStatus.IDLE', async () => {

Callers 1

Calls 1

sourceFunction · 0.85

Tested by

no test coverage detected