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

jest-mock-promise

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-mock-promise - npm Package Compare versions

Comparing version 1.0.23 to 1.1.0

dist/test/jest-mock-promise.test.d.ts

4

dist/jest-mock-promise.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["jest-mock-promise"]=t():e["jest-mock-promise"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var s=r[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){"use strict";/**
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["jest-mock-promise"]=t():e["jest-mock-promise"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){"use strict";/**
* Synchronous Promise, which gets settled (resolved or settled) in a synchronous manner.

@@ -20,3 +20,3 @@ *

*/
Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),s=function(){function e(e){this.handlers=[],this.handlerIx=0,this.state=n.PromiseState.pending,e&&e(this.resolveFn.bind(this),this.rejectFn.bind(this))}return e.prototype.resolveFn=function(e){this.data=e,this.state=n.PromiseState.resolved,this.err=void 0;for(var t=this.handlers.length;this.handlerIx<t;this.handlerIx++){var r,s=this.handlers[this.handlerIx];if(s.catch)break;try{r=s.then(this.data)}catch(e){this.handlerIx++,this.rejectFn(e)}void 0!==r&&(this.data=r)}},e.prototype.rejectFn=function(e){this.state=n.PromiseState.rejected,this.err=e;for(var t=this.handlers.length;this.handlerIx<t;this.handlerIx++){var r,s=this.handlers[this.handlerIx];if(s.catch){r=s.catch(e),this.handlerIx++,this.resolveFn(r);break}}},e.prototype.then=function(e,t){switch(this.state){case n.PromiseState.rejected:t&&t(this.err);break;case n.PromiseState.resolved:e(this.data);break;default:this.handlers.push({then:e}),t&&this.handlers.push({catch:t})}return this},e.prototype.catch=function(e){return this.state===n.PromiseState.resolved?e(this.err):this.handlers.push({catch:e}),this},e.prototype.resolve=function(e){this.resolveFn(e)},e.prototype.reject=function(e){this.rejectFn(e)},e.resolve=function(t){return console.warn("a promise created via `JestMockPromise.resolve` will be executed async ... for sync execution call `resolve` method on an instance of `Promise`"),new e(function(e,r){setTimeout(e(t),0)})},e.reject=function(t){return console.warn("a promise created via `JestMockPromise.reject` will be executed async ... for sync execution call `reject` method on an instance of `Promise`"),new e(function(e,r){setTimeout(r(t),0)})},e}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n;!function(e){e[e.pending=0]="pending",e[e.resolved=1]="resolved",e[e.rejected=2]="rejected"}(n||(n={})),t.PromiseState=n}])});
Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),i=function(){function e(e){this.handlers=[],this.handlerIx=0,this.state=n.PromiseState.pending,e&&e(this.resolveFn.bind(this),this.rejectFn.bind(this))}return e.prototype.resolveFn=function(e){this.data=e,this.state=n.PromiseState.resolved,this.err=void 0;for(var t=this.handlers.length;this.handlerIx<t;this.handlerIx++){var r=this.handlers[this.handlerIx];if(r.catch)break;if(r.finally)return void this.callFinally();try{e=r.then(e)}catch(e){this.handlerIx++,this.rejectFn(e)}}},e.prototype.rejectFn=function(e){this.state=n.PromiseState.rejected,this.err=e;for(var t=this.handlers.length;this.handlerIx<t;this.handlerIx++){var r,i=this.handlers[this.handlerIx];if(i.catch)try{r=i.catch(e),this.handlerIx++,this.resolveFn(r);break}catch(e){this.handlerIx++,this.rejectFn(e);break}else i.finally&&this.callFinally()}},e.prototype.callFinally=function(){for(var e=!1,t=this.handlers.length;this.handlerIx<t;this.handlerIx++){var r=this.handlers[this.handlerIx];try{if(r.finally)r.finally(),e=!0;else{if(r.then&&e){this.resolveFn();break}if(r.catch){e=!1;continue}}}catch(e){this.handlerIx++,this.rejectFn(e);break}}},e.prototype.then=function(e,t){switch(this.state){case n.PromiseState.rejected:t&&t(this.err);break;case n.PromiseState.resolved:e(this.data);break;default:this.handlers.push({then:e}),t&&this.handlers.push({catch:t})}return this},e.prototype.catch=function(e){return this.state===n.PromiseState.rejected?e(this.err):this.handlers.push({catch:e}),this},e.prototype.finally=function(e){return this.state!==n.PromiseState.pending?e():this.handlers.push({finally:e}),this},e.prototype.resolve=function(e){this.resolveFn(e)},e.prototype.reject=function(e){this.rejectFn(e)},e.resolve=function(t){return console.warn("a promise created via `JestMockPromise.resolve` will be executed async ... for sync execution call `resolve` method on an instance of `Promise`"),new e(function(e,r){setTimeout(e(t),0)})},e.reject=function(t){return console.warn("a promise created via `JestMockPromise.reject` will be executed async ... for sync execution call `reject` method on an instance of `Promise`"),new e(function(e,r){setTimeout(r(t),0)})},e}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n;!function(e){e[e.pending=0]="pending",e[e.resolved=1]="resolved",e[e.rejected=2]="rejected"}(n||(n={})),t.PromiseState=n}])});
//# sourceMappingURL=jest-mock-promise.js.map
{
"name": "jest-mock-promise",
"version": "1.0.23",
"version": "1.1.0",
"description": "Synchronous Promise Mock for testing with Jest",

@@ -8,3 +8,4 @@ "main": "dist/jest-mock-promise.js",

"scripts": {
"build": "webpack -p"
"build": "webpack -p",
"test": "jest --watchAll"
},

@@ -14,5 +15,8 @@ "author": "knee-cola <nikola.derezic@gmail.com>",

"devDependencies": {
"@types/jest": "^24.0.20",
"jest": "^24.9.0",
"ts-jest": "^24.1.0",
"ts-loader": "^3.1.1",
"typescript": "^2.6.1",
"webpack": "^3.8.1"
"typescript": "^2.9.2",
"webpack": "^3.12.0"
},

@@ -19,0 +23,0 @@ "repository": {

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