update test scripts

This commit is contained in:
Andre Staltz 2023-08-10 10:52:27 +03:00
parent 207f6a4692
commit 05d0523d1d
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
2 changed files with 6 additions and 4 deletions

View File

@ -43,8 +43,10 @@
"typescript": "^5.0.2" "typescript": "^5.0.2"
}, },
"scripts": { "scripts": {
"build": "tsc", "clean-check": "tsc --build --clean",
"test": "node --test", "prepublishOnly": "npm run clean-check && tsc --build",
"postpublish": "npm run clean-check",
"test": "npm run clean-check && node --test",
"format-code": "prettier --write \"*.js\" \"(test|lib)/*.js\"", "format-code": "prettier --write \"*.js\" \"(test|lib)/*.js\"",
"format-code-staged": "pretty-quick --staged --pattern \"*.js\" --pattern \"(test|lib)/*.js\"", "format-code-staged": "pretty-quick --staged --pattern \"*.js\" --pattern \"(test|lib)/*.js\"",
"coverage": "c8 --reporter=lcov npm run test" "coverage": "c8 --reporter=lcov npm run test"

View File

@ -83,7 +83,7 @@ test('accountAdd()', async (t) => {
const contentsBefore = fs.readFileSync(file, 'utf-8') const contentsBefore = fs.readFileSync(file, 'utf-8')
assert.strictEqual(contentsBefore, JSON.stringify([[token, promise]])) assert.strictEqual(contentsBefore, JSON.stringify([[token, promise]]))
const dbBefore = [...local.db.msgs()].map(({data}) => data) const dbBefore = [...local.db.msgs()].map(({ data }) => data)
assert.equal(dbBefore.length, 1) assert.equal(dbBefore.length, 1)
assert.equal(dbBefore[0].action, 'add') assert.equal(dbBefore[0].action, 'add')
assert.equal(dbBefore[0].add.key.algorithm, 'ed25519') assert.equal(dbBefore[0].add.key.algorithm, 'ed25519')
@ -103,7 +103,7 @@ test('accountAdd()', async (t) => {
}) })
assert.strictEqual(result1, true) assert.strictEqual(result1, true)
const dbAfter = [...local.db.msgs()].map(({data}) => data) const dbAfter = [...local.db.msgs()].map(({ data }) => data)
assert.equal(dbAfter.length, 2) assert.equal(dbAfter.length, 2)
assert.equal(dbAfter[0].action, 'add') assert.equal(dbAfter[0].action, 'add')
assert.equal(dbAfter[0].add.key.algorithm, 'ed25519') assert.equal(dbAfter[0].add.key.algorithm, 'ed25519')