Socket
Socket
Sign inDemoInstall

samsam

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

samsam - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

autolint.js

10

package.json
{
"name": "samsam",
"version": "0.1.0",
"version": "0.1.1",
"description": "Value identification and comparison functions",

@@ -16,3 +16,3 @@ "homepage": "http://busterjs.org/docs/buster-assertions",

}],
"main": "./samsam",
"main": "./lib/samsam",
"repository": {

@@ -25,6 +25,8 @@ "type": "git",

},
"dependencies": {
"lodash": "~0.4"
},
"devDependencies": {
"buster-util": ">=0.5",
"sinon": "~1.4"
"buster": "0.6.2"
}
}

78

test/samsam-test.js
if (typeof module === "object" && typeof require === "function") {
var assert = require("assert");
var buster = { util: require("buster-util") };
var sinon = require("sinon");
var samsam = require("../samsam");
var buster = require("buster");
var samsam = require("../lib/samsam");
}

@@ -15,3 +13,3 @@

tc["should return true for " + name] = function () {
assert.ok(samsam[method].apply(samsam, args));
assert(samsam[method].apply(samsam, args));
};

@@ -23,3 +21,3 @@ }

tc["should return false for " + name] = function () {
assert.ok(!samsam[method].apply(samsam, args));
assert(!samsam[method].apply(samsam, args));
};

@@ -32,5 +30,5 @@ }

samsam[method].apply(samsam, args);
assert.ok(false);
buster.assertion.fail("Expected to throw");
} catch (e) {
assert.ok(true);
assert(true);
}

@@ -44,12 +42,5 @@ }

body(pass, fail, shouldThrow, add);
buster.util.testCase(method, tc);
buster.testCase(method, tc);
}
tests("isArguments", function (pass, fail) {
pass("real arguments object", arguments);
fail("primitive", 42);
fail("object without length", {});
fail("array", []);
});
tests("isElement", function (pass, fail) {

@@ -66,18 +57,2 @@ if (typeof document !== "undefined") {

tests("isDate", function (pass, fail) {
pass("date object", new Date());
pass("date-like object", {
getTime: function () { return 42; },
valueOf: function () { return 42; }
});
fail("regular object", { getTime: function () { return 42; } });
fail("primitive", 42);
});
tests("isNaN", function (pass, fail) {
pass("NaN", NaN);
fail("number", 42);
fail("object", {});
});
tests("isNegZero", function (pass, fail) {

@@ -104,2 +79,4 @@ pass("-0", -0);

var anotherDate = new Date(date.getTime() - 10);
var sameDateWithProp = new Date(date.getTime());
sameDateWithProp.prop = 42;

@@ -118,10 +95,11 @@ pass("object to itself", obj, obj);

fail("date objects to null", date, null);
pass("strings and numbers with coercion", "4", 4);
pass("numbers and strings with coercion", 4, "4");
pass("number object with coercion", 32, new Number(32));
pass("number object reverse with coercion", new Number(32), 32);
pass("falsy values with coercion", 0, "");
pass("falsy values reverse with coercion", "", 0);
pass("string boxing with coercion", "4", new String("4"));
pass("string boxing reverse with coercion", new String("4"), "4");
fail("date with different custom properties", date, sameDateWithProp);
fail("strings and numbers with coercion", "4", 4);
fail("numbers and strings with coercion", 4, "4");
fail("number object with coercion", 32, new Number(32));
fail("number object reverse with coercion", new Number(32), 32);
fail("falsy values with coercion", 0, "");
fail("falsy values reverse with coercion", "", 0);
fail("string boxing with coercion", "4", new String("4"));
fail("string boxing reverse with coercion", new String("4"), "4");
pass("NaN to NaN", NaN, NaN);

@@ -165,2 +143,9 @@ fail("-0 to +0", -0, +0);

fail("nested array with shallow array", [["hey"]], ["hey"]);
var arr1 = [1, 2, 3];
var arr2 = [1, 2, 3];
arr1.prop = 42;
fail("arrays with different custom properties", arr1, arr2);
pass("regexp literals", /a/, /a/);

@@ -173,3 +158,2 @@ pass("regexp objects", new RegExp("[a-z]+"), new RegExp("[a-z]+"));

fail("nested array with shallow array", [["hey"]], ["hey"]);
fail("regexp objects with custom properties", re1, re2);

@@ -191,3 +175,3 @@ fail("different objects", { id: 42 }, {});

pass("arguments to array", [1,2,{},[]], gather(1, 2, {}, []));
pass("arguments to array", [1, 2, {}, []], gather(1, 2, {}, []));
pass("array to arguments", gather(), []);

@@ -225,5 +209,5 @@

add("should call matcher with object", function () {
var spy = sinon.spy();
var spy = this.spy();
samsam.match("Assertions 123", spy);
assert.ok(spy.calledWith("Assertions 123"));
assert.calledWith(spy, "Assertions 123");
});

@@ -237,5 +221,5 @@

fail("match string is not substring of object", {}, "Emacs");
fail("matcher is substring of object.toString", "Emacs", {
toString: function () { return "Emacs"; }
});
fail("matcher is not substring of object.toString", {
toString: function () { return "Vim"; }
}, "Emacs");
fail("null and empty string", null, "");

@@ -242,0 +226,0 @@ fail("undefined and empty string", undefined, "");

Sorry, the diff of this file is not supported yet

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