@jrc03c/make-key 0.0.38 → 0.0.40
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/moon.yml +0 -2
- package/package.json +1 -5
- package/src/index.test.mjs +4 -33
package/moon.yml
CHANGED
package/package.json
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
},
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@jrc03c/fake-jest": "^0.0.17",
|
|
7
|
-
"@jrc03c/js-math-tools": "^0.0.94",
|
|
8
7
|
"esbuild": "^0.25.4",
|
|
9
8
|
"eslint": "^8.36.0",
|
|
10
9
|
"prettier": "^3.5.3"
|
|
@@ -14,8 +13,5 @@
|
|
|
14
13
|
"module": "./src/index.mjs",
|
|
15
14
|
"name": "@jrc03c/make-key",
|
|
16
15
|
"type": "module",
|
|
17
|
-
"version": "0.0.
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"@jrc03c/js-math-tools": "file:../js-math-tools"
|
|
20
|
-
}
|
|
16
|
+
"version": "0.0.40"
|
|
21
17
|
}
|
package/src/index.test.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { expect, test } from "@jrc03c/fake-jest"
|
|
2
2
|
import { makeKey } from "./index.mjs"
|
|
3
|
-
import { random, seed } from "@jrc03c/js-math-tools"
|
|
4
3
|
|
|
5
4
|
test("tests that random strings can be generated correctly", () => {
|
|
6
5
|
const a = makeKey(123)
|
|
@@ -10,41 +9,13 @@ test("tests that random strings can be generated correctly", () => {
|
|
|
10
9
|
const c = makeKey(123)
|
|
11
10
|
expect(b).not.toBe(c)
|
|
12
11
|
|
|
13
|
-
seed(12345)
|
|
14
|
-
const d = makeKey(123, null, random)
|
|
15
|
-
seed(12345)
|
|
16
|
-
const e = makeKey(123, null, random)
|
|
17
|
-
expect(d).toBe(e)
|
|
18
|
-
|
|
19
|
-
seed(12345)
|
|
20
|
-
const f = makeKey(64, null, random)
|
|
21
|
-
seed(12345)
|
|
22
|
-
const g = makeKey(32, null, random)
|
|
23
|
-
expect(f.includes(g)).toBe(true)
|
|
24
|
-
expect(g.includes(f)).toBe(false)
|
|
25
|
-
|
|
26
12
|
const charset = "Hello, world!"
|
|
27
|
-
const
|
|
13
|
+
const d = makeKey(123, charset)
|
|
28
14
|
|
|
29
|
-
|
|
15
|
+
d.split("").forEach(char => {
|
|
30
16
|
expect(charset.includes(char)).toBe(true)
|
|
31
17
|
})
|
|
32
18
|
|
|
33
|
-
const
|
|
34
|
-
expect(
|
|
35
|
-
|
|
36
|
-
seed(12345)
|
|
37
|
-
const j = makeKey(123, charset, random)
|
|
38
|
-
seed(12345)
|
|
39
|
-
const k = makeKey(123, charset, random)
|
|
40
|
-
expect(j).toBe(k)
|
|
41
|
-
seed(12345)
|
|
42
|
-
expect(makeKey(123, "foobar", random)).not.toBe(k)
|
|
43
|
-
|
|
44
|
-
seed(12345)
|
|
45
|
-
const l = makeKey(64, charset, random)
|
|
46
|
-
seed(12345)
|
|
47
|
-
const m = makeKey(32, charset, random)
|
|
48
|
-
expect(l.includes(m)).toBe(true)
|
|
49
|
-
expect(m.includes(l)).toBe(false)
|
|
19
|
+
const e = makeKey(123, charset)
|
|
20
|
+
expect(e).not.toBe(d)
|
|
50
21
|
})
|