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

Function throwStatusAndErrors

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

Source from the content-addressed store, hash-verified

12import {TestBed} from '../../testing';
13
14function throwStatusAndErrors<T>(source: () => T | ResourceParamsStatus | Error): () => T {
15 return () => {
16 const value = source();
17 if (value instanceof Error) throw value;
18 if (value === ResourceParamsStatus.IDLE || value === ResourceParamsStatus.LOADING) throw value;
19 return value as T;
20 };
21}
22
23describe('resource with ResourceParamsStatus', () => {
24 for (const [paramsStatus, expectedStatus] of [

Callers 1

Calls 1

sourceFunction · 0.85

Tested by

no test coverage detected