How to use the ts-mockito.objectContaining function in ts-mockito

To help you get started, we’ve selected a few ts-mockito examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sillsdev / web-languageforge / src / SIL.XForge.Scripture / ClientApp / src / app / translate / editor / translate-metrics-session.spec.ts View on Github external
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();
  }));