Replace thirdparty parse-ms with my own, and add tests
Some checks failed
CI / CI (push) Failing after 11s
Some checks failed
CI / CI (push) Failing after 11s
This commit is contained in:
parent
5081b9fec9
commit
d738a0dcfc
4 changed files with 900014 additions and 11 deletions
10
package-lock.json
generated
10
package-lock.json
generated
|
@ -13,7 +13,6 @@
|
||||||
"discord.js": "^14.16.3",
|
"discord.js": "^14.16.3",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"mysql": "^2.18.1",
|
"mysql": "^2.18.1",
|
||||||
"parse-ms": "^2.1.0",
|
|
||||||
"prompt-sync": "^4.2.0",
|
"prompt-sync": "^4.2.0",
|
||||||
"seedrandom": "^3.0.5",
|
"seedrandom": "^3.0.5",
|
||||||
"sqlite3": "^5.1.6",
|
"sqlite3": "^5.1.6",
|
||||||
|
@ -4394,15 +4393,6 @@
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/parse-ms": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz",
|
|
||||||
"integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/path-exists": {
|
"node_modules/path-exists": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
"discord.js": "^14.16.3",
|
"discord.js": "^14.16.3",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"mysql": "^2.18.1",
|
"mysql": "^2.18.1",
|
||||||
"parse-ms": "^2.1.0",
|
|
||||||
"prompt-sync": "^4.2.0",
|
"prompt-sync": "^4.2.0",
|
||||||
"seedrandom": "^3.0.5",
|
"seedrandom": "^3.0.5",
|
||||||
"sqlite3": "^5.1.6",
|
"sqlite3": "^5.1.6",
|
||||||
|
|
900002
tests/expected/parse-ms-expected.json
Normal file
900002
tests/expected/parse-ms-expected.json
Normal file
File diff suppressed because it is too large
Load diff
12
tests/parse-ms.test.js
Normal file
12
tests/parse-ms.test.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
const parseMS = require('../util/parseMS')
|
||||||
|
const fs = require('fs')
|
||||||
|
|
||||||
|
const file = 'tests/expected/parse-ms-expected.json';
|
||||||
|
const expectedOutput = JSON.parse(fs.readFileSync(file, {encoding: "utf-8"}));
|
||||||
|
|
||||||
|
test("Testing my parseMS", () => {
|
||||||
|
for(let i = 0; i < expectedOutput.length; i++){
|
||||||
|
const ms = i * i * 2;
|
||||||
|
expect(parseMS(ms)).toStrictEqual(expectedOutput[i])
|
||||||
|
}
|
||||||
|
})
|
Loading…
Add table
Add a link
Reference in a new issue