You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a component test that has an insufficiently mocked dependency (my fault). It's the classic "it should create" test, consisting of MockBuilder + MockRender. It succeeds. However, it also spits out an error:
ERROR TypeError: this._store.deleteDialogIsOpen is not a function
at EffectHandle.effectFn (<MyAppDir>\src\app\the-component\the-component.component.ts:41:40)
at EffectHandle.runEffect (<MyAppDir>\node_modules\@angular\core\fesm2022\core.mjs:14207:18)
at Object.fn (<MyAppDir>\node_modules\@angular\core\fesm2022\core.mjs:14202:58)
at Object.run (<MyAppDir>\node_modules\@angular\core\fesm2022\primitives\signals.mjs:529:18)
at EffectHandle.run (<MyAppDir>\node_modules\@angular\core\fesm2022\core.mjs:14214:22)
at _ZoneAwareQueueingScheduler.flushQueue (<MyAppDir>\node_modules\@angular\core\fesm2022\core.mjs:14153:20)
at <MyAppDir>\node_modules\@angular\core\fesm2022\core.mjs:14143:41
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (<MyAppDir>\node_modules\zone.js\bundles\zone.umd.js:411:30)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (<MyAppDir>\node_modules\zone.js\bundles\zone-testing.umd.js:300:43)
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (<MyAppDir>\node_modules\zone.js\bundles\zone.umd.js:410:56)
at Object.onInvoke (<MyAppDir>\node_modules\@angular\core\fesm2022\core.mjs:14702:33)
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (<MyAppDir>\node_modules\zone.js\bundles\zone.umd.js:410:56)
at Zone.Object.<anonymous>.Zone.run (<MyAppDir>\node_modules\zone.js\bundles\zone.umd.js:165:47)
at _ZoneAwareQueueingScheduler.flush (<MyAppDir>\node_modules\@angular\core\fesm2022\core.mjs:14143:26)
at ComponentFixture.detectChanges (<MyAppDir>\node_modules\@angular\core\fesm2022\testing.mjs:230:28)
at template (<MyAppDir>\node_modules\ng-mocks\webpack:\ng-mocks\libs\ng-mocks\src\lib\mock-render\mock-render-factory.ts:162:37)
at t.MockRender (<MyAppDir>\node_modules\ng-mocks\index.js:1:219344)
at <MyAppDir>\src\app\the-component\the-component.component.spec.ts:16:31
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (<MyAppDir>\node_modules\zone.js\bundles\zone.umd.js:411:30)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (<MyAppDir>\node_modules\zone.js\bundles\zone-testing.umd.js:300:43)
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (<MyAppDir>\node_modules\zone.js\bundles\zone.umd.js:410:56)
at Zone.Object.<anonymous>.Zone.run (<MyAppDir>\node_modules\zone.js\bundles\zone.umd.js:165:47)
at Object.wrappedFunc (<MyAppDir>\node_modules\zone.js\bundles\zone-testing.umd.js:789:34)
at Promise.then.completed (<MyAppDir>\node_modules\jest-circus\build\utils.js:298:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (<MyAppDir>\node_modules\jest-circus\build\utils.js:231:10)
at _callCircusTest (<MyAppDir>\node_modules\jest-circus\build\run.js:316:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at _runTest (<MyAppDir>\node_modules\jest-circus\build\run.js:252:3)
at _runTestsForDescribeBlock (<MyAppDir>\node_modules\jest-circus\build\run.js:126:9)
at _runTestsForDescribeBlock (<MyAppDir>\node_modules\jest-circus\build\run.js:121:9)
at run (<MyAppDir>\node_modules\jest-circus\build\run.js:71:3)
at runAndTransformResultsToJestFormat (<MyAppDir>\node_modules\jest-circus\build\legacy-code-todo-rewrite\jestAdapterInit.js:122:21)
The component has an Angular Signals effect in its constructor. It fails because the signal it is supposed to act on is not present on the mock store. How would I detect this error and make the test fail?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have a component test that has an insufficiently mocked dependency (my fault). It's the classic "it should create" test, consisting of
MockBuilder+MockRender. It succeeds. However, it also spits out an error:The component has an Angular Signals effect in its constructor. It fails because the signal it is supposed to act on is not present on the mock store. How would I detect this error and make the test fail?
Beta Was this translation helpful? Give feedback.
All reactions