Skip to content

Commit 0e56cb6

Browse files
committed
use jasmine spyOn instead of ts-mockito spy for questionDoc
simply doing `spy(await env.getQuestionDoc('q6Id'))` with ts-mockito spy results in later errors: > Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'get') > TypeError: Cannot read properties of undefined (reading 'get') > at Spy.getEmptyMethodStub (node_modules/ts-mockito/lib/Spy.js:41:48) Perhaps more awaiting needed to happen first for something to be populated. Not being able to pin it down, there was instead success in moving to jasmine spyOn.
1 parent bfed433 commit 0e56cb6

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/SIL.XForge.Scripture/ClientApp/src/app/checking/checking/checking.component.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2292,13 +2292,13 @@ describe('CheckingComponent', () => {
22922292

22932293
it('update answer audio cache on remote removal of an answer', fakeAsync(async () => {
22942294
const env = new TestEnvironment({ user: ADMIN_USER });
2295-
const questionDoc = spy(await env.getQuestionDoc('q6Id'));
2295+
const questionDoc = await env.getQuestionDoc('q6Id');
2296+
spyOn(questionDoc, 'updateAnswerFileCache').and.callThrough();
22962297
env.selectQuestion(6);
2297-
verify(questionDoc!.updateAnswerFileCache()).times(1);
2298+
expect(questionDoc.updateAnswerFileCache).toHaveBeenCalledTimes(1);
2299+
// SUT
22982300
await env.simulateRemoteDeleteAnswer('q6Id', 0);
2299-
verify(questionDoc!.updateAnswerFileCache()).times(2);
2300-
expect().nothing();
2301-
tick();
2301+
expect(questionDoc.updateAnswerFileCache).toHaveBeenCalledTimes(2);
23022302
flush(1000);
23032303
}));
23042304

0 commit comments

Comments
 (0)