@identity-js/identity 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BUG-HISTORY.md +2 -3
- package/README.md +56 -56
- package/lib/core.js +2 -2
- package/lib/meta2IdentityFunctionsUnstable.js +11 -3
- package/lib/meta2Unstable.js +3 -3
- package/lib/numberIdentity.js +265 -0
- package/lib/primitive.js +1 -1
- package/lib/primitiveCore.js +158 -0
- package/lib/stringIdentity.js +972 -0
- package/lib/syncResolveBluebird.js +8 -0
- package/lib/syncResolveCoreJS.js +8 -0
- package/lib/syncResolveES6Promise.js +8 -0
- package/lib/syncResolveES6PromisePolyfill.js +8 -0
- package/lib/{syncResolve.js → syncResolveIsAPromise.js} +7 -7
- package/lib/syncResolvePinkiePromise.js +8 -0
- package/lib/syncResolvePromisePolyfill.js +8 -0
- package/lib/syncResolveSchrodingerPlus.js +8 -0
- package/lib/syncResolveThenPromise.js +8 -0
- package/package.json +585 -74
- package/test/enterprise.js +73 -0
- package/test/mocha.js +2271 -0
- package/unstable.d.ts +2 -2
- package/test/index.js +0 -192
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const { enterpriseTest, printAuditSummary } = require("enterprise-10x-testing-framework-js")
|
|
2
|
+
const i = require("..")
|
|
3
|
+
const randoBool = require("@falsejs/random-boolean")
|
|
4
|
+
|
|
5
|
+
enterpriseTest("Sanity checks", (assert) => {
|
|
6
|
+
assert(!!i, "should be truthy")
|
|
7
|
+
assert(typeof i === "function", "should be a function")
|
|
8
|
+
assert(true, "Smoke test")
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
enterpriseTest("Undefined Audit", (assert) => {
|
|
12
|
+
assert(i(undefined) === undefined, "should return the primitive value undefined when given the primitive value undefined")
|
|
13
|
+
assert(i() === undefined, "should return the primitive value undefined when given no arguments")
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
enterpriseTest("Null Audit", (assert) => {
|
|
17
|
+
assert(i(null) === null, "should return the primitive value null when given the primitive value null")
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
enterpriseTest("Boolean Audit", (assert) => {
|
|
21
|
+
assert(i(true) === true, "should return the boolean value true when given the boolean value true")
|
|
22
|
+
assert(i(false) === false, "should return the boolean value false when given the boolean value false")
|
|
23
|
+
var myRandom = randoBool()
|
|
24
|
+
assert(i(myRandom) === myRandom, "should return the same random boolean value passed in")
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
enterpriseTest("Number Audit", (assert) => {
|
|
28
|
+
assert(i(1) === 1, "should return positive number less than 101 when passed in positive number less than 101")
|
|
29
|
+
assert(i(-32) === -32, "should return negative number greater than -101 when passed in negative number greater than -101")
|
|
30
|
+
assert(i(105) === 105, "should return positive number greater than 101 when passed in positive number greater than 101")
|
|
31
|
+
assert(i(105) === 105, "should return positive number greater than 101 when passed in positive number greater than 101")
|
|
32
|
+
assert(i(-5000) === -5000, "should return negative number greater than -101 when passed in negative number greater than -101")
|
|
33
|
+
assert(Object.is(i(-0), -0), "should return negative zero when passed in negative zero")
|
|
34
|
+
assert(!(x=>x==x)(i(NaN)), "should return NaN when passed in NaN")
|
|
35
|
+
assert(i(Infinity) === Infinity, "should return Infinity when passed in Infinity")
|
|
36
|
+
assert(i( - Infinity) === - Infinity, "should return -Infinity when passed in -Infinity")
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
enterpriseTest("String Audit", (assert) => {
|
|
40
|
+
assert(i("") === "", "should return an empty string when provided an empty string")
|
|
41
|
+
assert(i("a") === "a", "should return 'a' when provided 'a'")
|
|
42
|
+
assert(i("1") === "1", "should return '1' when provided '1'")
|
|
43
|
+
assert(i("!") === "!", "should return '!' when provided '!'")
|
|
44
|
+
assert(i("creashaks organzine") === "creashaks organzine", "should return 'creashaks organzine' when provided 'creashaks organzine'")
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
enterpriseTest("Symbol Audit", (assert) => {
|
|
48
|
+
assert(i(Symbol.asyncDispose) === Symbol.asyncDispose, "should return Symbol.asyncDispose when provided Symbol.asyncDispose")
|
|
49
|
+
assert(i(Symbol.asyncIterator) === Symbol.asyncIterator, "should return Symbol.asyncIterator when provided Symbol.asyncIterator")
|
|
50
|
+
assert(i(Symbol.dispose) === Symbol.dispose, "should return Symbol.dispose when provided Symbol.dispose")
|
|
51
|
+
assert(i(Symbol.hasInstance) === Symbol.hasInstance, "should return Symbol.hasInstance when provided Symbol.hasInstance")
|
|
52
|
+
assert(i(Symbol.isConcatSpreadable) === Symbol.isConcatSpreadable, "should return Symbol.isConcatSpreadable when provided Symbol.isConcatSpreadable")
|
|
53
|
+
assert(i(Symbol.iterator) === Symbol.iterator, "should return Symbol.iterator when provided Symbol.iterator")
|
|
54
|
+
assert(i(Symbol.match) === Symbol.match, "should return Symbol.match when provided Symbol.match")
|
|
55
|
+
assert(i(Symbol.matchAll) === Symbol.matchAll, "should return Symbol.matchAll when provided Symbol.matchAll")
|
|
56
|
+
assert(i(Symbol.replace) === Symbol.replace, "should return Symbol.replace when provided Symbol.replace")
|
|
57
|
+
assert(i(Symbol.search) === Symbol.search, "should return Symbol.search when provided Symbol.search")
|
|
58
|
+
assert(i(Symbol.species) === Symbol.species, "should return Symbol.species when provided Symbol.species")
|
|
59
|
+
assert(i(Symbol.split) === Symbol.split, "should return Symbol.split when provided Symbol.split")
|
|
60
|
+
assert(i(Symbol.toPrimitive) === Symbol.toPrimitive, "should return Symbol.toPrimitive when provided Symbol.toPrimitive")
|
|
61
|
+
assert(i(Symbol.toStringTag) === Symbol.toStringTag, "should return Symbol.toStringTag when provided Symbol.toStringTag")
|
|
62
|
+
assert(i(Symbol.unscopables) === Symbol.unscopables, "should return Symbol.unscopables when provided Symbol.unscopables")
|
|
63
|
+
|
|
64
|
+
const custom = Symbol("custom")
|
|
65
|
+
assert(i(custom) === custom, "should return the same custom symbol when provided a custom symbol")
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
enterpriseTest("BigInt Audit", (assert) => {
|
|
69
|
+
assert(i(0n) === 0n, "should return 0n when provided 0n")
|
|
70
|
+
assert(i(12345678901234567890n) === 12345678901234567890n, "should return 12345678901234567890n when provided 12345678901234567890n")
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
printAuditSummary()
|