Socket
Socket
Sign inDemoInstall

jasmine-marbles

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jasmine-marbles

Marble testing helpers for RxJS and Jasmine


Version published
Weekly downloads
185K
increased by13.58%
Maintainers
2
Weekly downloads
 
Created

Package description

What is jasmine-marbles?

The jasmine-marbles package is a library for testing RxJS observables using marble diagrams in Jasmine. It allows developers to create and test complex asynchronous code in a more readable and maintainable way by using marble syntax to represent the behavior of observables over time.

What are jasmine-marbles's main functionalities?

Testing Observable Streams

This feature allows you to test the behavior of cold observables by using marble diagrams. The `cold` function creates a cold observable, and `expectObservable` is used to assert that the observable behaves as expected.

const { cold, hot, expectObservable, expectSubscriptions } = require('jasmine-marbles');

it('should test cold observable', () => {
  const source = cold('--a--b--c|');
  const expected = '--a--b--c|';
  expectObservable(source).toBe(expected);
});

Testing Hot Observables

This feature allows you to test the behavior of hot observables. The `hot` function creates a hot observable, and `expectObservable` is used to assert that the observable behaves as expected.

const { cold, hot, expectObservable, expectSubscriptions } = require('jasmine-marbles');

it('should test hot observable', () => {
  const source = hot('-a-^--b--c|');
  const expected = '---b--c|';
  expectObservable(source).toBe(expected);
});

Testing Subscriptions

This feature allows you to test the subscription behavior of observables. The `expectSubscriptions` function is used to assert that the observable's subscriptions match the expected subscription pattern.

const { cold, hot, expectObservable, expectSubscriptions } = require('jasmine-marbles');

it('should test subscriptions', () => {
  const source = cold('--a--b--c|');
  const subs = '^-------!';
  expectSubscriptions(source.subscriptions).toBe(subs);
});

Other packages similar to jasmine-marbles

Readme

Source

jasmine-marbles

Marble testing helpers for RxJS and Jasmine

Helpful Links

  • Marble Syntax
  • Providing Mock Actions for testing NgRx Actions with jasmine-marbles

Supported RxJS versions

  • 0.2.0 supports RxJS 5.x
  • => 0.3.* supports RxJS 6.x
  • => 0.9.0 supports RxJS 7.x

Keywords

FAQs

Package last updated on 02 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc