add basic test
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
c5fcc57e5d
commit
9b8d49f774
|
@ -7,10 +7,13 @@
|
|||
"author": "Jakub Sokołowski <jakub@status.im>",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "node_modules/.bin/rollup -c"
|
||||
"build": "node_modules/.bin/rollup -c",
|
||||
"test": "node -r esm test/main.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esm": "^3.2.25",
|
||||
"rollup": "^1.31.0",
|
||||
"rollup-plugin-terser": "^5.2.0"
|
||||
"rollup-plugin-terser": "^5.2.0",
|
||||
"zora": "^3.1.8"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,4 @@ function uncompressedPublicKeyToChatName(pubKeyStr) {
|
|||
]
|
||||
}
|
||||
|
||||
let pubKeyStr = "0x0461f576da67dc0bca9888cdb4cb28c80285b756b324109da94a081585ed6f007cf00afede6b3ee5638593674fee100b590318fc7bdb0054b8dd9445acea216ad2";
|
||||
let chatName = uncompressedPublicKeyToChatName(pubKeyStr)
|
||||
|
||||
console.dir(chatName)
|
||||
export { uncompressedPublicKeyToChatName }
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
import { test } from 'zora'
|
||||
import { uncompressedPublicKeyToChatName } from '../src/main.js'
|
||||
|
||||
const testCases = [
|
||||
{
|
||||
name: [ 'Studious', 'Gold', 'Mustang' ],
|
||||
key: "0x0461f576da67dc0bca9888cdb4cb28c80285b756b324109da94a081585ed6f007cf00afede6b3ee5638593674fee100b590318fc7bdb0054b8dd9445acea216ad2",
|
||||
},
|
||||
{
|
||||
name: [ 'Studious', 'Gold', 'Mustang' ],
|
||||
key: "0x0461f576da67dc0bca9888cdb4cb28c80285b756b324109da94a081585ed6f007cf00afede6b3ee5638593674fee100b590318fc7bdb0054b8dd9445acea216ad2",
|
||||
},
|
||||
]
|
||||
|
||||
test('uncompressedPublicKeyToChatName', t => {
|
||||
for (let c of testCases) {
|
||||
let chatName = uncompressedPublicKeyToChatName(c.key)
|
||||
t.equal(chatName, c.name, `should return ${c.name.join(' ')}`)
|
||||
}
|
||||
})
|
10
yarn.lock
10
yarn.lock
|
@ -76,6 +76,11 @@ escape-string-regexp@^1.0.5:
|
|||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
|
||||
|
||||
esm@^3.2.25:
|
||||
version "3.2.25"
|
||||
resolved "https://registry.yarnpkg.com/esm/-/esm-3.2.25.tgz#342c18c29d56157688ba5ce31f8431fbb795cc10"
|
||||
integrity sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==
|
||||
|
||||
estree-walker@^0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362"
|
||||
|
@ -176,3 +181,8 @@ terser@^4.6.2:
|
|||
commander "^2.20.0"
|
||||
source-map "~0.6.1"
|
||||
source-map-support "~0.5.12"
|
||||
|
||||
zora@^3.1.8:
|
||||
version "3.1.8"
|
||||
resolved "https://registry.yarnpkg.com/zora/-/zora-3.1.8.tgz#84cf75a057005931058db43366cad8c75a21f04c"
|
||||
integrity sha512-AArEyKiLWi3eLXW2uRbfPvANfSQgV8VHoCuXCihCTQyUv7brFrghGbsUqKxqucc+QodQ1G2+O8Gpsz8RVpeiRQ==
|
||||
|
|
Loading…
Reference in New Issue