New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@hirez_io/observer-spy

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hirez_io/observer-spy - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

dist/subscribe-and-spy-on.d.ts

1

dist/index.d.ts
export { ObserverSpy } from './observer-spy';
export { subscribeAndSpyOn, ObserverSpyWithSubscription } from './subscribe-and-spy-on';
export { fakeTime } from './fake-time';
//# sourceMappingURL=index.d.ts.map

@@ -5,4 +5,7 @@ "use strict";

exports.ObserverSpy = observer_spy_1.ObserverSpy;
var subscribe_and_spy_on_1 = require("./subscribe-and-spy-on");
exports.subscribeAndSpyOn = subscribe_and_spy_on_1.subscribeAndSpyOn;
exports.ObserverSpyWithSubscription = subscribe_and_spy_on_1.ObserverSpyWithSubscription;
var fake_time_1 = require("./fake-time");
exports.fakeTime = fake_time_1.fakeTime;
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "@hirez_io/observer-spy",
"version": "1.2.1",
"version": "1.3.0",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

@@ -11,4 +11,5 @@ # @hirez_io/observer-spy 👀💪

[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<div align="center">

@@ -139,2 +140,28 @@ <a href="http://testangular.com/?utm_source=github&utm_medium=link&utm_campaign=observer-spy">

## Quick Usage with `subscribeAndSpyOn(observable)`
You can also create an `ObserverSpy` and immediately subscribe to an observable with this simple helper function.
Observer spies generated that way will provide an additional `unsubscribe()` method that you might want to call
if your source observable does not complete or does not get terminated by an error while testing.
**Example:**
```js
import { subscribeAndSpyOn } from '@hirez_io/observer-spy';
it('should immediately subscribe and spy on Observable ', () => {
const fakeObservable = of('first', 'second', 'third');
// get an "ObserverSpyWithSubscription"
const observerSpy = subscribeAndSpyOn(fakeObservable);
// and optionally unsubscribe
observerSpy.unsubscribe();
expect(observerSpy.getFirstValue()).toEqual('first');
// or use the shorthand version:
expect(subscribeAndSpyOn(fakeObservable).getFirstValue()).toEqual('first');
});
```
# Testing Async Observables

@@ -319,4 +346,5 @@

<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
export { ObserverSpy } from './observer-spy';
export { subscribeAndSpyOn, ObserverSpyWithSubscription } from './subscribe-and-spy-on';
export { fakeTime } from './fake-time';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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