How to use the ts-mockito.deepEqual 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 / identity / forgot-password / forgot-password.component.spec.ts View on Github external
it('should submit when email or username is specified', fakeAsync(() => {
    const env = new TestEnvironment();
    when(env.mockedIdentityService.forgotPassword(anything())).thenResolve(true);
    env.fixture.detectChanges();

    env.setInputValue(env.userInput, 'user');
    env.clickSubmitButton();

    verify(env.mockedIdentityService.forgotPassword(deepEqual('user'))).once();
    verify(env.mockedNoticeService.show(anyString())).once();
    expect().nothing();
    flush();
  }));
github sillsdev / web-languageforge / src / SIL.XForge.Scripture / ClientApp / src / app / project / project.component.spec.ts View on Github external
it('navigate to last text', fakeAsync(() => {
    const env = new TestEnvironment();
    env.setProjectData({ selectedTask: 'translate' });
    env.fixture.detectChanges();
    flush();

    verify(env.mockedRouter.navigate(deepEqual(['./', 'translate', 'text02']), anything())).once();
    expect().nothing();
  }));
github sillsdev / web-languageforge / src / SIL.XForge.Scripture / ClientApp / src / app / translate / editor / editor.component.spec.ts View on Github external
private addTextData(id: TextDataId): void {
    when(this.mockedTextService.getTextData(deepEqual(id))).thenResolve(this.createTextData(id));
  }
}
github sillsdev / web-languageforge / src / SIL.XForge.Scripture / ClientApp / src / app / connect-project / connect-project.component.spec.ts View on Github external
},
      checkingConfig: {
        enabled: true
      },
      translateConfig: {
        enabled: true,
        sourceParatextId: 'pt02',
        sourceInputSystem: {
          languageName: 'Spanish',
          tag: 'es',
          isRightToLeft: false,
          abbreviation: 'es'
        }
      }
    });
    verify(env.mockedSFProjectService.onlineCreate(deepEqual(project))).once();

    verify(env.mockedSFProjectUserService.onlineCreate('project01', 'user01')).once();

    verify(env.mockedRouter.navigate(deepEqual(['/projects', 'project01']))).once();
  }));
github intershop / intershop-pwa / src / app / extensions / quoting / store / quote-request / quote-request.effects.spec.ts View on Github external
effects.updateSubmitQuoteRequest$.subscribe(action => {
        verify(quoteRequestServiceMock.updateQuoteRequest('QRID', deepEqual({ displayName: 'edited' }))).once();
        expect(action).toMatchInlineSnapshot(`
          [Quote API] Update Quote Request Fail:
            error: {"message":"something went wrong"}
        `);
        done();
      });
    });
github sillsdev / web-languageforge / src / SIL.XForge.Scripture / ClientApp / src / app / project / project.component.spec.ts View on Github external
setNoProjectData(): void {
    when(
      this.mockedSFProjectService.get(
        'project01',
        deepEqual([[nameof('users')], [nameof('texts')]])
      )
    ).thenReturn(of(new MapQueryResults(null)));
  }
github sillsdev / web-languageforge / src / SIL.XForge.Scripture / ClientApp / src / app / translate / translate-overview / translate-overview.component.spec.ts View on Github external
private addTextData(id: TextDataId): void {
    when(this.mockedTextService.getTextData(deepEqual(id))).thenResolve(this.createTextData(id));
  }
github sillsdev / web-languageforge / src / SIL.XForge.Scripture / ClientApp / src / app / project / project.component.spec.ts View on Github external
setProjectData(args: { isTranslateEnabled?: boolean; hasTexts?: boolean; selectedTask?: string }): void {
    when(
      this.mockedSFProjectService.get(
        'project01',
        deepEqual([[nameof('users')], [nameof('texts')]])
      )
    ).thenReturn(
      of(
        new MapQueryResults(
          new SFProject({
            id: 'project01',
            translateConfig: { enabled: args.isTranslateEnabled == null || args.isTranslateEnabled },
            checkingConfig: { enabled: true },
            users: [new SFProjectUserRef('projectuser01')],
            texts: args.hasTexts == null || args.hasTexts ? [new TextRef('text01'), new TextRef('text02')] : undefined
          }),
          undefined,
          [
            new SFProjectUser({
              id: 'projectuser01',
              user: new UserRef('user01'),
github sillsdev / web-languageforge / src / SIL.XForge.Scripture / ClientApp / src / app / checking / checking-overview / checking-overview.component.spec.ts View on Github external
{ id: 'text02', bookId: 'LUK', name: 'Luke', chapters: [{ number: 1 }] } as Text
      ])
    );
    const text1_1id = new TextJsonDataId('text01', 1);
    when(this.mockedTextService.getQuestionData(deepEqual(text1_1id))).thenResolve(
      this.createQuestionData(text1_1id, [
        { id: 'q1Id', ownerRef: undefined, projectRef: undefined, text: 'Book 1, Q1 text' },
        { id: 'q2Id', ownerRef: undefined, projectRef: undefined, text: 'Book 1, Q2 text' }
      ])
    );
    const text1_3id = new TextJsonDataId('text01', 3);
    when(this.mockedTextService.getQuestionData(deepEqual(text1_3id))).thenResolve(
      this.createQuestionData(text1_3id, [])
    );
    const text2_1id = new TextJsonDataId('text02', 1);
    when(this.mockedTextService.getQuestionData(deepEqual(text2_1id))).thenResolve(
      this.createQuestionData(text2_1id, [
        { id: 'q3Id', ownerRef: undefined, projectRef: undefined, text: 'Book 2, Q3 text' }
      ])
    );

    TestBed.configureTestingModule({
      imports: [DialogTestModule],
      declarations: [CheckingOverviewComponent],
      schemas: [CUSTOM_ELEMENTS_SCHEMA],
      providers: [
        { provide: ActivatedRoute, useFactory: () => instance(this.mockedActivatedRoute) },
        { provide: SFAdminAuthGuard, useFactory: () => instance(this.mockedSFAdminAuthGuard) },
        { provide: MdcDialog, useFactory: () => instance(this.mockedMdcDialog) },
        { provide: NoticeService, useFactory: () => instance(this.mockedNoticeService) },
        { provide: SFProjectService, useFactory: () => instance(this.mockedProjectService) },
        { provide: TextService, useFactory: () => instance(this.mockedTextService) },