mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 21:52:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
14
web/node_modules/ext/test/function/identity.js
generated
vendored
Normal file
14
web/node_modules/ext/test/function/identity.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, identity = require("../../function/identity");
|
||||
|
||||
describe("function/identity", function () {
|
||||
it("Should return first argument", function () {
|
||||
assert.equal(identity("foo"), "foo");
|
||||
var object = {};
|
||||
assert.equal(identity(object), object);
|
||||
assert.equal(identity(), undefined);
|
||||
assert.equal(identity(1, 2, 3), 1);
|
||||
});
|
||||
});
|
13
web/node_modules/ext/test/global-this/implementation.js
generated
vendored
Normal file
13
web/node_modules/ext/test/global-this/implementation.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
var isObject = require("type/object/is")
|
||||
, assert = require("chai").assert
|
||||
, globalThis = require("../../global-this/implementation");
|
||||
|
||||
describe("global-this/implementation", function () {
|
||||
it("Should be an object", function () { assert(isObject(globalThis)); });
|
||||
it("Should be a global object", function () { assert.equal(globalThis.Array, Array); });
|
||||
it("Internal resolution should not introduce side-effects", function () {
|
||||
assert(!("__global__" in Object.prototype));
|
||||
});
|
||||
});
|
10
web/node_modules/ext/test/global-this/index.js
generated
vendored
Normal file
10
web/node_modules/ext/test/global-this/index.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
var isObject = require("type/object/is")
|
||||
, assert = require("chai").assert
|
||||
, globalThis = require("../../global-this");
|
||||
|
||||
describe("global-this", function () {
|
||||
it("Should be an object", function () { assert(isObject(globalThis)); });
|
||||
it("Should be a global object", function () { assert.equal(globalThis.Array, Array); });
|
||||
});
|
8
web/node_modules/ext/test/global-this/is-implemented.js
generated
vendored
Normal file
8
web/node_modules/ext/test/global-this/is-implemented.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, isImplemented = require("../../global-this/is-implemented");
|
||||
|
||||
describe("global-this/is-implemented", function () {
|
||||
it("Should return boolean", function () { assert.equal(typeof isImplemented(), "boolean"); });
|
||||
});
|
13
web/node_modules/ext/test/math/ceil-10.js
generated
vendored
Normal file
13
web/node_modules/ext/test/math/ceil-10.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, ceil10 = require("../../math/ceil-10");
|
||||
|
||||
describe("math/ceil-10", function () {
|
||||
it("Should ceil", function () {
|
||||
assert.equal(ceil10(55.51, -1), 55.6);
|
||||
assert.equal(ceil10(51, 1), 60);
|
||||
assert.equal(ceil10(-55.59, -1), -55.5);
|
||||
assert.equal(ceil10(-59, 1), -50);
|
||||
});
|
||||
});
|
13
web/node_modules/ext/test/math/floor-10.js
generated
vendored
Normal file
13
web/node_modules/ext/test/math/floor-10.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, floor10 = require("../../math/floor-10");
|
||||
|
||||
describe("math/floor-10", function () {
|
||||
it("Should floor", function () {
|
||||
assert.equal(floor10(55.59, -1), 55.5);
|
||||
assert.equal(floor10(59, 1), 50);
|
||||
assert.equal(floor10(-55.51, -1), -55.6);
|
||||
assert.equal(floor10(-51, 1), -60);
|
||||
});
|
||||
});
|
19
web/node_modules/ext/test/math/round-10.js
generated
vendored
Normal file
19
web/node_modules/ext/test/math/round-10.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, round10 = require("../../math/round-10");
|
||||
|
||||
describe("math/round-10", function () {
|
||||
it("Should round", function () {
|
||||
assert.equal(round10(55.55, -1), 55.6);
|
||||
assert.equal(round10(55.549, -1), 55.5);
|
||||
assert.equal(round10(55, 1), 60);
|
||||
assert.equal(round10(54.9, 1), 50);
|
||||
assert.equal(round10(-55.55, -1), -55.5);
|
||||
assert.equal(round10(-55.551, -1), -55.6);
|
||||
assert.equal(round10(-55, 1), -50);
|
||||
assert.equal(round10(-55.1, 1), -60);
|
||||
assert.equal(round10(1.005, -2), 1.01);
|
||||
assert.equal(round10(-1.005, -2), -1.0);
|
||||
});
|
||||
});
|
15
web/node_modules/ext/test/object/entries/_tests.js
generated
vendored
Normal file
15
web/node_modules/ext/test/object/entries/_tests.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
"use strict";
|
||||
|
||||
var assert = require("chai").assert;
|
||||
|
||||
module.exports = function (entries) {
|
||||
it("Should resolve entries array for an object", function () {
|
||||
assert.deepEqual(entries({ foo: "bar" }), [["foo", "bar"]]);
|
||||
});
|
||||
it("Should resolve entries array for a primitive", function () {
|
||||
assert.deepEqual(entries("raz"), [["0", "r"], ["1", "a"], ["2", "z"]]);
|
||||
});
|
||||
it("Should throw on non-value", function () {
|
||||
assert["throws"](function () { entries(null); }, TypeError);
|
||||
});
|
||||
};
|
6
web/node_modules/ext/test/object/entries/implementation.js
generated
vendored
Normal file
6
web/node_modules/ext/test/object/entries/implementation.js
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
var entries = require("../../../object/entries/implementation")
|
||||
, tests = require("./_tests");
|
||||
|
||||
describe("object/entries/implementation", function () { tests(entries); });
|
6
web/node_modules/ext/test/object/entries/index.js
generated
vendored
Normal file
6
web/node_modules/ext/test/object/entries/index.js
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
var entries = require("../../../object/entries")
|
||||
, tests = require("./_tests");
|
||||
|
||||
describe("object/entries/index", function () { tests(entries); });
|
8
web/node_modules/ext/test/object/entries/is-implemented.js
generated
vendored
Normal file
8
web/node_modules/ext/test/object/entries/is-implemented.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, isImplemented = require("../../../object/entries/is-implemented");
|
||||
|
||||
describe("object/entries/is-implemented", function () {
|
||||
assert.equal(typeof isImplemented(), "boolean");
|
||||
});
|
36
web/node_modules/ext/test/string/random.js
generated
vendored
Normal file
36
web/node_modules/ext/test/string/random.js
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, random = require("../../string/random");
|
||||
|
||||
var isValidFormat = RegExp.prototype.test.bind(/^[a-z0-9]+$/);
|
||||
|
||||
describe("string/random", function () {
|
||||
it("Should return string", function () { assert.equal(typeof random(), "string"); });
|
||||
it("Should return by default string of length 10", function () {
|
||||
assert.equal(random().length, 10);
|
||||
});
|
||||
it("Should support custom charset", function () {
|
||||
var charset = "abc";
|
||||
var result = random({ charset: charset });
|
||||
assert.equal(result.length, 10);
|
||||
for (var i = 0; i < result.length; ++i) {
|
||||
assert.isAtLeast(charset.indexOf(result.charAt(i)), 0);
|
||||
}
|
||||
});
|
||||
it("Should ensure unique string with `isUnique` option", function () {
|
||||
assert.notEqual(random({ isUnique: true }), random({ isUnique: true }));
|
||||
});
|
||||
it("Should contain only ascii chars", function () { assert(isValidFormat(random())); });
|
||||
it("Should support `length` option", function () {
|
||||
assert.equal(random({ length: 4 }).length, 4);
|
||||
assert.equal(random({ length: 100 }).length, 100);
|
||||
assert.equal(random({ length: 0 }).length, 0);
|
||||
});
|
||||
it("Should crash if unable to generate unique string with `isUnique` optin", function () {
|
||||
random({ length: 0, isUnique: true });
|
||||
assert["throws"](function () {
|
||||
random({ length: 0, isUnique: true });
|
||||
}, "Cannot generate random string");
|
||||
});
|
||||
});
|
40
web/node_modules/ext/test/string_/includes/_tests.js
generated
vendored
Normal file
40
web/node_modules/ext/test/string_/includes/_tests.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
"use strict";
|
||||
|
||||
var assert = require("chai").assert;
|
||||
|
||||
module.exports = function (includes) {
|
||||
it("Should return true when context contains search string", function () {
|
||||
assert.equal(includes.call("razdwatrzy", "dwa"), true);
|
||||
});
|
||||
it("Should return true when context starts with search string", function () {
|
||||
assert.equal(includes.call("razdwa", "raz"), true);
|
||||
});
|
||||
it("Should return true when context ends with search string", function () {
|
||||
assert.equal(includes.call("razdwa", "dwa"), true);
|
||||
});
|
||||
it("Should return false when string doesn't contain search string", function () {
|
||||
assert.equal(includes.call("razdwa", "trzy"), false);
|
||||
});
|
||||
it("Should return false when context is empty and search string is not", function () {
|
||||
assert.equal(includes.call("", "a"), false);
|
||||
});
|
||||
it("Should return false when search string is longer than context", function () {
|
||||
assert.equal(includes.call("raz", "razdwa"), false);
|
||||
});
|
||||
it("Should return true when search string is same as context ", function () {
|
||||
assert.equal(includes.call("raz", "raz"), true);
|
||||
});
|
||||
it("Should return true when context starts with search string", function () {
|
||||
assert.equal(includes.call("razdwa", "raz"), true);
|
||||
});
|
||||
it("Should return true when search string is empty", function () {
|
||||
assert.equal(includes.call("raz", ""), true);
|
||||
});
|
||||
it("Should return true when both context and search string are empty", function () {
|
||||
assert.equal(includes.call("", ""), true);
|
||||
});
|
||||
it("Should support position argument", function () {
|
||||
assert.equal(includes.call("razdwa", "raz", 1), false);
|
||||
assert.equal(includes.call("razdwa", "dwa", 1), true);
|
||||
});
|
||||
};
|
5
web/node_modules/ext/test/string_/includes/implementation.js
generated
vendored
Normal file
5
web/node_modules/ext/test/string_/includes/implementation.js
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
describe("string_/includes/implementation", function () {
|
||||
require("./_tests")(require("../../../string_/includes/implementation"));
|
||||
});
|
5
web/node_modules/ext/test/string_/includes/index.js
generated
vendored
Normal file
5
web/node_modules/ext/test/string_/includes/index.js
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
describe("string_/includes/implementation", function () {
|
||||
require("./_tests")(require("../../../string_/includes"));
|
||||
});
|
8
web/node_modules/ext/test/string_/includes/is-implemented.js
generated
vendored
Normal file
8
web/node_modules/ext/test/string_/includes/is-implemented.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, isImplemented = require("../../../string_/includes/is-implemented");
|
||||
|
||||
describe("string_/includes/is-implemented", function () {
|
||||
it("Should return boolean", function () { assert.equal(typeof isImplemented(), "boolean"); });
|
||||
});
|
89
web/node_modules/ext/test/thenable_/finally.js
generated
vendored
Normal file
89
web/node_modules/ext/test/thenable_/finally.js
generated
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, sinon = require("sinon")
|
||||
, identity = require("../../function/identity")
|
||||
, finallyMethod = require("../../thenable_/finally");
|
||||
|
||||
var throwUnexpected = function () { throw new Error("Unexpected"); };
|
||||
|
||||
describe("thenable_/finally", function () {
|
||||
describe("Successful on fulfilled", function () {
|
||||
var callback, input, result;
|
||||
|
||||
before(function () {
|
||||
callback = sinon.fake();
|
||||
input = Promise.resolve("foo");
|
||||
result = finallyMethod.call(input, callback);
|
||||
return result;
|
||||
});
|
||||
|
||||
it("Should invoke finally callback", function () { assert(callback.calledOnce); });
|
||||
|
||||
it("Return promise should fulfill with original result", function () {
|
||||
return Promise.all([input, result]).then(function (results) {
|
||||
assert.equal(results[0], results[1]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Successful on rejected", function () {
|
||||
var callback, input, result;
|
||||
|
||||
before(function () {
|
||||
var inputError = new Error("Rejected");
|
||||
callback = sinon.fake();
|
||||
input = Promise.reject(inputError);
|
||||
result = finallyMethod.call(input, callback);
|
||||
return result["catch"](function (error) { if (error !== inputError) throw error; });
|
||||
});
|
||||
|
||||
it("Should invoke finally callback", function () { assert(callback.calledOnce); });
|
||||
|
||||
it("Return promise should fulfill with original result", function () {
|
||||
return Promise.all([input["catch"](identity), result["catch"](identity)]).then(
|
||||
function (results) { assert.equal(results[0], results[1]); }
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Failed on fulfilled", function () {
|
||||
var callback, result, finallyError;
|
||||
|
||||
before(function () {
|
||||
finallyError = new Error("Finally Rejected");
|
||||
callback = sinon.fake["throws"](finallyError);
|
||||
var input = Promise.resolve("foo");
|
||||
result = finallyMethod.call(input, callback);
|
||||
return result["catch"](function (error) { if (error !== finallyError) throw error; });
|
||||
});
|
||||
|
||||
it("Should invoke finally callback", function () { assert(callback.calledOnce); });
|
||||
|
||||
it("Return promise should be rejected with finally error", function () {
|
||||
return result.then(throwUnexpected, function (error) {
|
||||
assert.equal(finallyError, error);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Failed on rejected", function () {
|
||||
var callback, result, finallyError;
|
||||
|
||||
before(function () {
|
||||
finallyError = new Error("Finally Rejected");
|
||||
callback = sinon.fake["throws"](finallyError);
|
||||
var input = Promise.reject(new Error("Rejected"));
|
||||
result = finallyMethod.call(input, callback);
|
||||
return result["catch"](function (error) { if (error !== finallyError) throw error; });
|
||||
});
|
||||
|
||||
it("Should invoke finally callback", function () { assert(callback.calledOnce); });
|
||||
|
||||
it("Return promise should be rejected with finally error", function () {
|
||||
return result.then(throwUnexpected, function (error) {
|
||||
assert.equal(finallyError, error);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue