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

backoff-rxjs

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backoff-rxjs - npm Package Compare versions

Comparing version 6.1.0 to 6.1.1

cloudbuild.json

2

package.json
{
"name": "backoff-rxjs",
"version": "6.1.0",
"version": "6.1.1",
"description": "A collection of helpful RxJS operators to deal with backoff strategies (like exponential backoff)",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -300,2 +300,55 @@ import { expect } from 'chai';

});
it('should retry until shouldRetry is true', (done: MochaDone) => {
let errors = 0;
const retries = 2;
const isNotSoBad = (error: any) => error === 'not so bad';
Observable.create((observer: Observer<number>) => {
observer.next(42);
observer.complete();
})
.pipe(
map((x: any) => {
errors += 1;
throw errors < 2 ? 'not so bad' : 'really bad';
}),
retryBackoff({ initialInterval: 1, shouldRetry: isNotSoBad })
)
.subscribe(
() => {},
(err: any) => {
expect(errors).to.equal(2);
expect(err).to.equal('really bad');
done();
}
);
});
it('should increase the intervals calculated by backoffDelay function', () => {
testScheduler.run(({ expectObservable, cold, expectSubscriptions }) => {
const constantDelay = (iteration: number, initialInterval: number) =>
initialInterval;
const source = cold('-1-#');
const subs = [
' ^--!',
' ----^--!',
' --------^--!',
' ------------^--!',
' ----------------^--!'
];
const unsub = ' -------------------!';
const expected = ' -1---1---1---1---1--';
expectObservable(
source.pipe(
retryBackoff({
initialInterval: 1,
backoffDelay: constantDelay
})
),
unsub
).toBe(expected);
expectSubscriptions(source.subscriptions).toBe(subs);
});
});
});
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