How to use the jasmine-marbles.cold function in jasmine-marbles

To help you get started, we’ve selected a few jasmine-marbles 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 stefanoslig / angular-ngrx-nx-realworld-example-app / libs / auth / src / lib / +state / auth.effects.spec.ts View on Github external
it('should return a [ngrx-forms] SetErrors action if the register service throws', () => {
      const result = {
        error: {
          errors: { invalid: 'Invalid data' } as Errors,
        },
      };
      const registerAction = AuthActions.register();
      const setErrors = new SetErrors(result.error.errors);

      actions$ = hot('-a---', { a: registerAction });
      const response = cold('-#', {}, result);
      service.register = jest.fn(() => response);
      const expected = cold('--b', { b: setErrors });

      expect(effects.register$).toBeObservable(expected);
    });
  });
github SciCatProject / catanie / src / app / state-management / effects / jobs.effects.spec.ts View on Github external
it("should dispatch a showMessageAction", () => {
      const message = {
        type: MessageType.Success,
        content: "Job Created Successfully",
        duration: 5000
      };
      const action = fromActions.submitJobCompleteAction({ job });
      const outcome = showMessageAction({ message });

      actions = hot("-a", { a: action });

      const expected = cold("-b", { b: outcome });
      expect(effects.submitJobCompleteMessage$).toBeObservable(expected);
    });
  });
github burke-software / django-report-builder / js / src / app / effects / reports.spec.ts View on Github external
it("CheckExportStatus should dispatch another CheckExportStatus action if the download isn't ready", () => {
      actions = hot('a', {
        a: new Actions.CheckExportStatus({ reportId, taskId }),
      });
      const response = cold('-b', { b: { state: 'newp' } });
      const expected = cold(delay + 'c', {
        c: new Actions.CheckExportStatus({ reportId, taskId }),
      });

      service.checkStatus.and.returnValue(response);

      expect(effects.checkExportStatus$).toBeObservable(expected);
    });
github graycoreio / daffodil / apps / demo / src / app / product / pages / product-view / product-view.component.spec.ts View on Github external
it('should initialize product$', () => {
      facade.product$ = hot('ab', { a: null, b: mockProduct });
      component.ngOnInit();
      const expected = cold('ab', { a: null, b: mockProduct });
      expect(component.product$).toBeObservable(expected);
    });
github SAP / cloud-commerce-spartacus-storefront / projects / storefrontlib / src / cms-components / configurator / commons / config-overview-form / config-overview-form.component.spec.ts View on Github external
) {
  routerStateObservable = cold(routerMarbels, {
    a: mockRouterState,
  });
  configurationObservable = cold(configurationMarbels, {
    x: configCreate,
    y: configCreate2,
  });
  overviewObservable = cold(overviewMarbels, {
    u: configCreate,
    v: configCreate2,
  });
  component.ngOnInit();

  expect(component.configuration$).toBeObservable(
    cold(expectedMarbels, { u: configCreate, v: configCreate2 })
  );
}
github judithgull / koans / src / app / store / user / user.effect.spec.ts View on Github external
it('returns a UserUpsertSuccess, if request is successful ', () => {
    const testUser: IUser = {
      uid: 'uid',
      email: 'email1',
      ...testNonSensitiveUser
    };
    const action = new UserUpsertRequest(testUser);

    actions$.stream = hot('-a', { a: action });

    const completionAction = new UserUpsertSuccess(testUser);
    const expected = cold('-b', { b: completionAction });

    expect(effects.upsertUsers$).toBeObservable(expected);
  });
});
github ngrx / platform / modules / effects / spec / effect_sources.spec.ts View on Github external
it('should resolve effects from instances', () => {
        const sources$ = cold('--a--', { a: new SourceA() });
        const expected = cold('--a--', { a });

        const output = toActions(sources$);

        expect(output).toBeObservable(expected);
      });
github SAP / cloud-commerce-spartacus-storefront / projects / core / src / user / store / effects / forgot-password.effect.spec.ts View on Github external
it('should be able to request a forgot password email', () => {
      const action = new UserActions.ForgotPasswordEmailRequest(
        'test@test.com'
      );
      const completion1 = new UserActions.ForgotPasswordEmailRequestSuccess();
      const completion2 = new GlobalMessageActions.AddMessage({
        text: { key: 'forgottenPassword.passwordResetEmailSent' },
        type: GlobalMessageType.MSG_TYPE_CONFIRMATION,
      });

      actions$ = hot('-a', { a: action });
      const expected = cold('-(bc)', { b: completion1, c: completion2 });

      expect(effect.requestForgotPasswordEmail$).toBeObservable(expected);
    });
  });
github SciCatProject / catanie / src / app / state-management / effects / samples.effects.spec.ts View on Github external
it("should result in a fetchSamplesCompleteAction and a fetchSamplesCountAction", () => {
        const samples = [sample];
        const action = fromActions.setTextFilterAction({ text });
        const outcome1 = fromActions.fetchSamplesCompleteAction({ samples });
        const outcome2 = fromActions.fetchSamplesCountAction();

        actions = hot("-a", { a: action });
        const response = cold("-a|", { a: samples });
        sampleApi.fullquery.and.returnValue(response);

        const expected = cold("--(bc)", { b: outcome1, c: outcome2 });
        expect(effects.fetchSamples$).toBeObservable(expected);
      });
github graycoreio / daffodil / apps / demo / src / app / cart / components / cart-wrapper / cart-wrapper.component.spec.ts View on Github external
it('returns cartSelector.isCartEmpty', () => {
      const expected = cold('(a)', { a: stubIsCartEmpty });
      expect(cartWrapperComponent.isCartEmpty$).toBeObservable(expected);
    });
  });

jasmine-marbles

Marble testing helpers for RxJS and Jasmine

MIT
Latest version published 3 years ago

Package Health Score

64 / 100
Full package analysis