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

unexpected-sinon

Package Overview
Dependencies
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unexpected-sinon - npm Package Compare versions

Comparing version 10.3.0 to 10.4.0

43

lib/unexpected-sinon.js

@@ -159,2 +159,13 @@ /*global location*/

expect.addType({
name: 'sinonSandbox',
base: 'object',
identify: function (obj) {
return obj && typeof obj === 'object' && typeof obj.useFakeTimers === 'function' && typeof obj.restore === 'function';
},
inspect: function (value, depth, output, inspect) {
output.jsFunctionName('sinon sandbox');
}
});
expect.addType({
name: 'spyCall',

@@ -413,7 +424,12 @@ base: 'object',

expect.addAssertion('<spy|array> to have calls [exhaustively] satisfying <function>', function (expect, subject, value) {
var spies = subject;
if (!Array.isArray(spies)) {
spies = [ spies ];
function extractSpies(spyOrArrayOrSinonSandbox) {
if (expect.findTypeOf(spyOrArrayOrSinonSandbox).is('sinonSandbox')) {
return spyOrArrayOrSinonSandbox.fakes || [];
} else {
return Array.isArray(spyOrArrayOrSinonSandbox) ? spyOrArrayOrSinonSandbox : [ spyOrArrayOrSinonSandbox ];
}
}
expect.addAssertion('<spy|array|sinonSandbox> to have calls [exhaustively] satisfying <function>', function (expect, subject, value) {
var spies = extractSpies(subject);
var expectedSpyCallSpecs = recordSpyCalls(spies, value);

@@ -432,7 +448,4 @@ var expectedSpyCalls = [];

expect.addAssertion('<spy|array> to have calls [exhaustively] satisfying <array|object>', function (expect, subject, value) {
var spies = subject;
if (!Array.isArray(spies)) {
spies = [ spies ];
}
expect.addAssertion('<spy|array|sinonSandbox> to have calls [exhaustively] satisfying <array|object>', function (expect, subject, value) {
var spies = extractSpies(subject);
var spyCalls = [];

@@ -549,3 +562,3 @@ var isSeenBySpyId = {};

expect.addAssertion('<spy> to have a call [exhaustively] satisfying <object>', function (expect, subject, value) {
expect.addAssertion('<spy|array|sinonSandbox> to have a call [exhaustively] satisfying <object>', function (expect, subject, value) {
var keys = Object.keys(value);

@@ -562,3 +575,5 @@ if (

expect.errorMode = 'defaultOrNested';
var calls = getCalls(subject);
// Get a flattened array of all calls to all the specified spies:
var calls = Array.prototype.concat.apply([], extractSpies(subject).map(getCalls));
var promises = calls.map(function (call) {

@@ -580,8 +595,8 @@ return expect.promise(function () {

expect.addAssertion('<spy> to have a call [exhaustively] satisfying <array>', function (expect, subject, value) {
expect.addAssertion('<spy|array|sinonSandbox> to have a call [exhaustively] satisfying <array>', function (expect, subject, value) {
return expect(subject, 'to have a call [exhaustively] satisfying', { args: value });
});
expect.addAssertion('<spy> to have a call satisfying <function>', function (expect, subject, value) {
var expectedSpyCallSpecs = recordSpyCalls([subject], value);
expect.addAssertion('<spy|array|sinonSandbox> to have a call satisfying <function>', function (expect, subject, value) {
var expectedSpyCallSpecs = recordSpyCalls(extractSpies(subject), value);
var expectedSpyCalls = [];

@@ -588,0 +603,0 @@ expectedSpyCallSpecs.forEach(function (expectedSpyCallSpec) {

{
"name": "unexpected-sinon",
"version": "10.3.0",
"version": "10.4.0",
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is too big to display

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