Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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

  • 0.9.0-beta.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
175K
decreased by-15.96%
Maintainers
2
Weekly downloads
 
Created

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

Keywords

FAQs

Package last updated on 10 Jun 2021

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc