Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('dispose', fakeAsync(() => {
const env = new TestEnvironment();
env.startSession();
env.keyPress('a');
env.keyPress('b');
expect(env.session.metrics.type).toBe('edit');
verify(env.mockedSFProjectService.addTranslateMetrics('project01', anything())).never();
const sessionId = env.session.id;
const metricsId = env.session.metrics.id;
env.session.dispose();
verify(
env.mockedSFProjectService.addTranslateMetrics(
'project01',
objectContaining({
id: metricsId,
type: 'edit',
sessionId: sessionId,
textRef: 'text01',
chapter: 1,
keyCharacterCount: 2,
segment: 'verse_1_1',
sourceWordCount: 8,
targetWordCount: 8,
editEndEvent: 'task-exit'
})
)
).once();
}));