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

Function verifySpies

packages/forms/test/reactive_integration_spec.ts:4729–4750  ·  view source on GitHub ↗
(control: AbstractControl, expected: any = {})

Source from the content-addressed store, hash-verified

4727
4728 // Verify whether all spies attached to a given control match expectations.
4729 function verifySpies(control: AbstractControl, expected: any = {}) {
4730 const debug = (control as any).__debug__;
4731 const viewValidatorCallCount = expected.viewValidatorCallCount ?? 1;
4732 const ownValidatorCallCount = expected.ownValidatorCallCount ?? 1;
4733 const valueAccessorCallCount = expected.valueAccessorCallCount ?? 1;
4734 verifySpyCalls(debug.validatorSpy, expected.ownValidators, ownValidatorCallCount);
4735 verifySpyCalls(debug.asyncValidatorSpy, expected.ownValidators, ownValidatorCallCount);
4736 verifySpyCalls(debug.valueChangesSpy, expected.valueChanges);
4737 if (debug.viewValidatorSpy) {
4738 verifySpyCalls(debug.viewValidatorSpy, expected.viewValidators, viewValidatorCallCount);
4739 }
4740 if (debug.viewAsyncValidatorSpy) {
4741 verifySpyCalls(
4742 debug.viewAsyncValidatorSpy,
4743 expected.viewValidators,
4744 viewValidatorCallCount,
4745 );
4746 }
4747 if (debug.valueAccessorSpy) {
4748 verifySpyCalls(debug.valueAccessorSpy, expected.valueAccessor, valueAccessorCallCount);
4749 }
4750 }
4751
4752 // Init a test with a predefined set of validator and value accessor classes.
4753 async function initCleanupTest(component: Type<any>) {

Callers 1

Calls 1

verifySpyCallsFunction · 0.85

Tested by

no test coverage detected