Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
jasmine-marbles
Advanced tools
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.
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);
});
rxjs-marbles is another library for testing RxJS observables using marble diagrams. It provides similar functionality to jasmine-marbles but is designed to work with various testing frameworks like Jest, Mocha, and Jasmine. It offers a more flexible API and better integration with different testing environments.
jest-marbles is a library specifically designed for testing RxJS observables using marble diagrams in Jest. It provides a similar API to jasmine-marbles but is tailored for use with the Jest testing framework, offering better integration and more idiomatic Jest syntax.
Marble testing helpers for RxJS and Jasmine
Helpful Links
0.9.0-beta.0 (2021-06-10)
BEFORE:
Minimum dependencies: TypeScript 4.1.x RxJS 6.5.x
AFTER:
Minimum dependencies: TypeScript 4.2.x RxJS 7.x.x
FAQs
Marble testing helpers for RxJS and Jasmine
The npm package jasmine-marbles receives a total of 136,689 weekly downloads. As such, jasmine-marbles popularity was classified as popular.
We found that jasmine-marbles demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.