How to use the jasmine-marbles.hot 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 opfab / operatorfabric-core / ui / main / src / app / store / effects / config.effects.spec.ts View on Github external
it('should return a LoadConfigsSuccess when the configService serve configuration', () => {
            const expectedConfig = {value: {subValue1: 1, subValue2: 2}};

            const localActions$ = new Actions(hot('-a--', {a: new LoadConfig()}));

            // const localMockConfigService = jasmine.createSpyObj('ConfigService', ['fetchConfiguration']);

            configService.fetchConfiguration.and.returnValue(hot('---b', {b: expectedConfig}));
            const expectedAction = new LoadConfigSuccess({config: expectedConfig});
            const localExpected = hot('---c', {c: expectedAction});

            effects = new ConfigEffects(mockStore, localActions$, configService);

            expect(effects).toBeTruthy();
            expect(effects.loadConfiguration).toBeObservable(localExpected);
        });
        it('should return a LoadConfigsFailure when the configService doesn\'t serve configuration', () => {
github opfab / operatorfabric-core / ui / main / src / app / store / effects / custom-router.effects.spec.ts View on Github external
it('should trigger ClearLightCardSelection if navigating from feed/cards/* to somewhere else', () => {

            const navigation = {
                type: ROUTER_REQUEST,
                payload: {
                    routerState: {
                        url: "/feed/cards/myCardId"
                    },
                    event: new NavigationStart(1,"/archive/")
                }
            }

            const localActions$ = new Actions(hot('-a-', { a: navigation}));

            const expectedAction = new ClearLightCardSelection();
            const localExpected = hot('-b-', {b: expectedAction});

            effects = new CustomRouterEffects(mockStore, localActions$);

            expect(effects).toBeTruthy();
            expect(effects.navigateAwayFromFeed).toBeObservable(localExpected);

        });
github opfab / operatorfabric-core / ui / main / src / app / store / effects / translate.effects.spec.ts View on Github external
// there is no i18n file referenced in the store
        const cachedI18n$ = hot('-b', {b:new Map>()});
        storeMock.select.withArgs(selectI18nUpLoaded).and.returnValue(cachedI18n$);


        expect(underTest).toBeTruthy();



        // an UpdateTranslation is expected
        const expectedVersions=new Set(lightCards.map(card=>card.publisherVersion));
        const expectedThirdAndVersion=generateThirdWithVersion('testPublisher',expectedVersions);
        const expectedEmittedActions = hot('-c'
            , {
                c: new UpdateTranslation({versions: expectedThirdAndVersion})
            });
        expect(underTest.verifyTranslationNeeded).toBeObservable(expectedEmittedActions);
    });
github SAP / cloud-commerce-spartacus-storefront / src / app / routing / store / effects / router.effect.spec.ts View on Github external
it('should navigate back', () => {
      const action = new fromActions.Back();

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

      spyOn(location, 'back');
      effects.navigate$.subscribe(value => {
        expect(location.back).toHaveBeenCalled();
      });
    });
  });
github SAP / cloud-commerce-spartacus-storefront / projects / core / src / configurator / commons / store / effects / configurator.effect.spec.ts View on Github external
it('should emit a success action with content for an action of type readConfiguration', () => {
    const payloadInput = { configId: configId };
    const action = new ConfiguratorActions.ReadConfiguration(payloadInput);

    const completion = new ConfiguratorActions.ReadConfigurationSuccess(
      productConfiguration
    );
    actions$ = hot('-a', { a: action });
    const expected = cold('-b', { b: completion });

    expect(configEffects.readConfiguration$).toBeObservable(expected);
  });
github SAP / cloud-commerce-spartacus-storefront / projects / core / src / product / store / effects / product-search.effect.spec.ts View on Github external
it('should return searchResult from SearchProductsSuccess', () => {
      const action = new ProductActions.SearchProducts({
        queryText: 'test',
        searchConfig: searchConfig,
      });
      const completion = new ProductActions.SearchProductsSuccess(searchResult);

      actions$ = hot('-a', { a: action });
      const expected = cold('-b', { b: completion });

      expect(effects.searchProducts$).toBeObservable(expected);
    });
  });
github SAP / cloud-commerce-spartacus-storefront / projects / core / src / routing / store / effects / router.effect.spec.ts View on Github external
it('should navigate forward', () => {
      const action = new RoutingActions.RouteBackAction();

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

      spyOn(location, 'forward');
      effects.navigate$.subscribe(() => {
        expect(location.forward).toHaveBeenCalled();
      });
    });
  });
github SAP / cloud-commerce-spartacus-storefront / src / app / product / store / effects / product-search.effect.spec.ts View on Github external
it('should return suggestions from GetProductSuggestionsSuccess', () => {
      const action = new fromActions.GetProductSuggestions({
        term: 'test',
        searchConfig: new SearchConfig(10)
      });
      const completion = new fromActions.GetProductSuggestionsSuccess(
        suggestions.suggestions
      );

      actions$.stream = hot('-a', { a: action });
      const expected = cold('-b', { b: completion });

      expect(effects.getProductSuggestions$).toBeObservable(expected);
    });
  });
github fabric8-ui / fabric8-ui / packages / planner / src / app / effects / infotip.effects.spec.ts View on Github external
it('should dispatch an error action', () => {
    const action = new Actions.Get();
    const error = new Actions.GetError();

    infotipService.getInfotips.and.returnValue(throwError(new Error()));

    actions = hot('--a-', { a: action });
    const expected = cold('--b', { b: error });

    expect(isObservable(effects.getInfotips$)).toBeTruthy();
  });
});
github DSpace / dspace-angular / src / app / core / shared / operators.spec.ts View on Github external
it('should return the resourceSelfLinks for all successful responses', () => {
      const source = hot('abcde', testRCEs);
      const result = source.pipe(getResourceLinksFromResponse());
      const expected = cold('a--d-', {
        a: testRCEs.a.response.resourceSelfLinks,
        d: testRCEs.d.response.resourceSelfLinks
      });

      expect(result).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