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

unexpected

Package Overview
Dependencies
Maintainers
2
Versions
330
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unexpected - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

27

lib/unexpected.js

@@ -156,3 +156,3 @@ // Copyright (c) 2013 Sune Simonsen <sune@we-knowhow.dk>

Unexpected.prototype.clone = function () {
var unexpected = new Unexpected(objectCreate(this.assertions));
var unexpected = new Unexpected(extend({}, this.assertions));
return makeExpectFunction(unexpected);

@@ -943,6 +943,10 @@ };

function objectCreate(parent) {
function F() {}
F.prototype = parent;
return new F();
function extend(target) {
var sources = Array.prototype.slice.call(arguments, 1);
forEach(sources, function (source) {
forEach(getKeys(source), function (key) {
target[key] = source[key];
});
});
return target;
}

@@ -991,15 +995,2 @@

function extend(target) {
var extensions = Array.prototype.slice.call(arguments, 1);
return reduce(extensions, function (result, extension) {
for(var prop in extension) {
if(hasOwnProperty(extension, prop)) {
target[prop] = extension[prop];
}
}
return target;
}, target);
}
/**

@@ -1006,0 +997,0 @@ * Asserts deep equality

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

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

@@ -64,3 +64,3 @@ # Unexpected

```js
define(['unexpected/lib/unexpected.js'], funtion (expect) {
define(['unexpected/lib/unexpected.js'], function (expect) {
// Your code

@@ -67,0 +67,0 @@ });

@@ -564,9 +564,10 @@ /*global describe, it, expect*/

it('throws if the assertion does not exists', function () {
expect(function () {
expect(1, "foo bar", 2);
}, 'to throw exception', 'Unknown assertion "foo bar", did you mean: "to be"');
});
});
it('throws if the assertion does not exists', function () {
expect(function () {
expect(1, "to bee", 2);
}, 'to throw exception', 'Unknown assertion "to bee", did you mean: "to be"');
});
function sortBy(arr, property) {

@@ -745,3 +746,29 @@ arr.sort(function (x, y) {

});
it('suggests an assertion if the given assertion does not exists', function () {
expect(function () {
clonedExpect(1, "to bee", 2);
}, 'to throw', 'Unknown assertion "to bee", did you mean: "to be"');
expect(function () {
clonedExpect(1, "to be answer to the ultimate question of life, the universe, and everything");
}, 'to throw', 'Unknown assertion "to be answer to the ultimate question of life, the universe, and everything", did you mean: "to be answer to the Ultimate Question of Life, the Universe, and Everything"');
});
describe('toString', function () {
it('returns a string containing all the expanded assertions', function () {
expect(clonedExpect.toString(), 'to contain', 'to be');
expect(clonedExpect.toString(), 'to contain', 'not to be');
expect(clonedExpect.toString(), 'to contain', 'to be answer to the Ultimate Question of Life, the Universe, and Everything');
expect(clonedExpect.toString(), 'to contain', 'not to be answer to the Ultimate Question of Life, the Universe, and Everything');
});
});
});
describe('toString', function () {
it('returns a string containing all the expanded assertions', function () {
expect(expect.toString(), 'to contain', 'to be');
expect(expect.toString(), 'to contain', 'not to be');
});
});
});
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