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

unexpected

Package Overview
Dependencies
Maintainers
1
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 0.0.2 to 0.0.3

test/common.js

46

lib/unexpected.js

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

function expect(subject, testDescriptionString) {
var matching = assertions.filter(function (assertionRule) {
var matching = filter(assertions, function (assertionRule) {
return assertionRule.test(testDescriptionString);

@@ -162,3 +162,3 @@ });

if (this.flags.own) {
this.assert(this.obj.hasOwnProperty(key));
this.assert(hasOwnProperty(this.obj, key));
} else {

@@ -203,3 +203,3 @@ this.assert(this.obj[key] !== undefined);

var hasKeys = obj && every(keys, function (key) {
return obj.hasOwnProperty(key);
return hasOwnProperty(obj, key);
});

@@ -594,3 +594,3 @@ if (this.flags.only) {

for (var i in obj) {
if (Object.prototype.hasOwnProperty.call(obj, i)) {
if (hasOwnProperty(obj, i)) {
result.push(i);

@@ -603,2 +603,6 @@ }

function hasOwnProperty(obj, property) {
return Object.prototype.hasOwnProperty.call(obj, property);
}
function map(arr, mapper, that) {

@@ -609,3 +613,3 @@ if (Array.prototype.map) {

var other= new Array(arr.length);
var other = new Array(arr.length);

@@ -619,3 +623,27 @@ for (var i= 0, n = arr.length; i<n; i++)

function reduce (arr, fun) {
function filter(arr, predicate) {
if (Array.prototype.filter) {
return Array.prototype.filter.apply(
arr, Array.prototype.slice.call(arguments, 1)
);
}
var length = +arr.length;
var result = [];
if (typeof predicate !== "function")
throw new TypeError();
for (var i = 0; i < length; i += 1) {
var value = arr[i];
if (predicate(value)) {
result.push(value);
}
}
return result;
}
function reduce(arr, fun) {
if (Array.prototype.reduce) {

@@ -627,3 +655,3 @@ return Array.prototype.reduce.apply(

var len = +this.length;
var len = +arr.length;

@@ -915,3 +943,3 @@ if (typeof fun !== "function")

for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
if (hasOwnProperty(value, k)) {
v = str(k, value);

@@ -996,3 +1024,3 @@ if (v) {

for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
if (hasOwnProperty(value, k)) {
v = walk(value, k);

@@ -999,0 +1027,0 @@ if (v !== undefined) {

5

package.json
{
"name": "unexpected",
"version": "0.0.2",
"version": "0.0.3",
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>",

@@ -19,4 +19,5 @@ "keywords": [ "assertion", "test", "assert" ],

"mocha": "~1.9.0",
"mocha-slow-reporter": "*"
"mocha-slow-reporter": "*",
"serve": "*"
}
}

@@ -18,2 +18,4 @@ # Unexpected

[Run the test in the browser](http://sunesimonsen.github.io/unexpected/test/tests.html)
## Features

@@ -23,4 +25,4 @@

- Node.JS ready (`require('unexpected')`).
- TODO: Cross-browser: works on IE6+, Firefox, Safari, Chrome, Opera.
- TODO: Standalone. Single global with no prototype extensions or shims.
- Single global with no prototype extensions or shims.
- Cross-browser: works on IE6+, Firefox, Safari, Chrome, Opera.

@@ -27,0 +29,0 @@ ## How to use

@@ -1,7 +0,11 @@

/*global describe, it*/
console.log();
var expect = process.env.COVERAGE ?
require('../lib-cov/unexpected') :
require('../lib/unexpected');
/*global describe, it, expect*/
// use this instead of Object.create in order to make the tests run in
// es5 compatible browsers
function create(o) {
function F() {}
F.prototype = o;
return new F();
}
describe('unexpected', function () {

@@ -64,3 +68,3 @@ describe('ok/truthy/falsy assertion', function () {

expect(5, 'to be a', Array);
}, 'to throw exception', 'expected 5 to be a [Function: Array]');
}, 'to throw exception', /expected 5 to be a \[Function(: Array)?\]/);
});

@@ -183,3 +187,3 @@ });

expect({a: 'b'}, 'to have own property', 'a');
expect(Object.create({a: 'b'}), 'to not have own property', 'a');
expect(create({a: 'b'}), 'to not have own property', 'a');
});

@@ -186,0 +190,0 @@

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