diff --git a/components/shared/BalanceInput.vue b/components/shared/BalanceInput.vue
index afcedde316..c83bf08aed 100644
--- a/components/shared/BalanceInput.vue
+++ b/components/shared/BalanceInput.vue
@@ -9,12 +9,14 @@
:min="minWithUnit"
:max="maxWithUnit"
:expanded="expanded"
- @input="handleInput" />
+ @input="handleInput"
+ data-testid="balance-input" />
+ @input="handleUnitChange"
+ data-testid="balance-input-select">
diff --git a/package.json b/package.json
index aabc853b08..e4b7774332 100644
--- a/package.json
+++ b/package.json
@@ -31,7 +31,8 @@
"lint:fix": "eslint --fix --quiet --ignore-path .gitignore --ext .js,.ts,.vue .",
"test": "vitest run --reporter verbose --allowOnly",
"test:e2e": "cypress run --project tests",
- "test:watch": "vitest --reporter verbose --allowOnly",
+ "test:watch": "vitest --reporter verbose",
+ "test:coverage": "vitest run --coverage",
"prepare": "husky install"
},
"husky": {
@@ -125,7 +126,9 @@
"@types/markdown-it": "^12.2.3",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
+ "@vue/test-utils": "^1.3.0",
"all-contributors-cli": "^6.20.0",
+ "c8": "^7.12.0",
"consola": "^2.15.3",
"cypress": "^10.3.0",
"cross-env": "^7.0.3",
@@ -143,6 +146,7 @@
"sass": "^1.54.0",
"sass-loader": "^10.3",
"typescript": "^4.7.4",
+ "vite-plugin-vue2": "^2.0.2",
"vitest": "^0.20.2",
"vue-debounce-decorator": "^1.0.1"
},
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index a792bf82b8..3c8bbce941 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -37,10 +37,12 @@ specifiers:
'@types/markdown-it': ^12.2.3
'@typescript-eslint/eslint-plugin': ^5.31.0
'@typescript-eslint/parser': ^5.31.0
+ '@vue/test-utils': ^1.3.0
all-contributors-cli: ^6.20.0
apollo-boost: ^0.4.9
axios: ^0.27.2
buefy: ^0.9.21
+ c8: ^7.12.0
chart.js: ^3.8.2
chartjs-adapter-date-fns: ^2.0.0
chartjs-plugin-annotation: ^1.4.0
@@ -77,6 +79,7 @@ specifiers:
slugify: ^1.6.5
typescript: ^4.7.4
v-emoji-picker: ^2.3.3
+ vite-plugin-vue2: ^2.0.2
vitest: ^0.20.2
vue: 2.6.14
vue-apollo: ^3.1.0
@@ -163,7 +166,9 @@ devDependencies:
'@types/markdown-it': 12.2.3
'@typescript-eslint/eslint-plugin': 5.31.0_d5zwcxr4bwkhmuo464cb3a2puu
'@typescript-eslint/parser': 5.31.0_he2ccbldppg44uulnyq4rwocfa
+ '@vue/test-utils': 1.3.0_vue@2.6.14
all-contributors-cli: 6.20.0
+ c8: 7.12.0
consola: 2.15.3
cross-env: 7.0.3
eslint: 8.20.0
@@ -180,7 +185,8 @@ devDependencies:
sass: 1.54.0
sass-loader: 10.3.1_sass@1.54.0
typescript: 4.7.4
- vitest: 0.20.2_jsdom@19.0.0+sass@1.54.0
+ vite-plugin-vue2: 2.0.2_lodash@4.17.21
+ vitest: 0.20.2_mw23ezpxlxnjur3jzk6gbvzckm
vue-debounce-decorator: 1.0.1
packages:
@@ -1808,6 +1814,10 @@ packages:
'@babel/helper-validator-identifier': 7.18.6
to-fast-properties: 2.0.0
+ /@bcoe/v8-coverage/0.2.3:
+ resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==}
+ dev: true
+
/@cloudflare/kv-asset-handler/0.2.0:
resolution: {integrity: sha512-MVbXLbTcAotOPUj0pAMhVtJ+3/kFkwJqc5qNOleOZTv6QkZZABDMS21dSrSlVswEHwrpWC03e4fWytjqKvuE2A==}
dependencies:
@@ -2531,6 +2541,11 @@ packages:
json5: 2.2.1
dev: false
+ /@istanbuljs/schema/0.1.3:
+ resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==}
+ engines: {node: '>=8'}
+ dev: true
+
/@josephg/resolvable/1.0.1:
resolution: {integrity: sha512-CtzORUwWTTOTqfVtHaKRJ0I1kNQd1bpn3sUh8I3nJDVY+5/M/Oe1DnEWzPQvqq/xPIIkzzzIP7mfCoAjFRvDhg==}
dev: false
@@ -4647,6 +4662,10 @@ packages:
resolution: {integrity: sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w==}
dev: false
+ /@types/istanbul-lib-coverage/2.0.4:
+ resolution: {integrity: sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==}
+ dev: true
+
/@types/jest/27.5.2:
resolution: {integrity: sha512-mpT8LJJ4CMeeahobofYWIjFo0xonRS/HfxnVEPMPFSQdGUt1uHCnoPT7Zhb+sjDU2wz0oKV0OLUR0WzrHNgfeA==}
dependencies:
@@ -5289,6 +5308,18 @@ packages:
resolution: {integrity: sha512-4rSJemR2NQIo9Klm1vabqWjD8rs/ZaJSzMxkMNeJS6lHiUjjUeYFbooN19NgFjztubEKh3WlZUeOLVdbbUWHsw==}
dev: true
+ /@vue/test-utils/1.3.0_vue@2.6.14:
+ resolution: {integrity: sha512-Xk2Xiyj2k5dFb8eYUKkcN9PzqZSppTlx7LaQWBbdA8tqh3jHr/KHX2/YLhNFc/xwDrgeLybqd+4ZCPJSGPIqeA==}
+ peerDependencies:
+ vue: 2.x
+ vue-template-compiler: ^2.x
+ dependencies:
+ dom-event-types: 1.1.0
+ lodash: 4.17.21
+ pretty: 2.0.0
+ vue: 2.6.14
+ dev: true
+
/@vueuse/head/0.7.6_vue@2.6.14:
resolution: {integrity: sha512-cOWqCkT3WiF5oEpw+VVEWUJd9RLD5rc7DmnFp3cePsejp+t7686uKD9Z9ZU7Twb7R/BI8iexKTmXo9D/F3v6UA==}
peerDependencies:
@@ -7024,6 +7055,25 @@ packages:
rc9: 1.2.2
dev: true
+ /c8/7.12.0:
+ resolution: {integrity: sha512-CtgQrHOkyxr5koX1wEUmN/5cfDa2ckbHRA4Gy5LAL0zaCFtVWJS5++n+w4/sr2GWGerBxgTjpKeDclk/Qk6W/A==}
+ engines: {node: '>=10.12.0'}
+ hasBin: true
+ dependencies:
+ '@bcoe/v8-coverage': 0.2.3
+ '@istanbuljs/schema': 0.1.3
+ find-up: 5.0.0
+ foreground-child: 2.0.0
+ istanbul-lib-coverage: 3.2.0
+ istanbul-lib-report: 3.0.0
+ istanbul-reports: 3.1.5
+ rimraf: 3.0.2
+ test-exclude: 6.0.0
+ v8-to-istanbul: 9.0.1
+ yargs: 16.2.0
+ yargs-parser: 20.2.9
+ dev: true
+
/cacache/12.0.4:
resolution: {integrity: sha512-a0tMB40oefvuInr4Cwb3GerbL9xTj1D5yg0T5xrjGCGyfvbxseIXX7BAO/u/hIXdafzOI5JC3wDwHyf24buOAQ==}
dependencies:
@@ -7740,6 +7790,22 @@ packages:
readable-stream: 2.3.7
typedarray: 0.0.6
+ /condense-newlines/0.2.1:
+ resolution: {integrity: sha512-P7X+QL9Hb9B/c8HI5BFFKmjgBu2XpQuF98WZ9XkO+dBGgk5XgwiQz7o1SmpglNWId3581UcS0SFAWfoIhMHPfg==}
+ engines: {node: '>=0.10.0'}
+ dependencies:
+ extend-shallow: 2.0.1
+ is-whitespace: 0.3.0
+ kind-of: 3.2.2
+ dev: true
+
+ /config-chain/1.1.13:
+ resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==}
+ dependencies:
+ ini: 1.3.8
+ proto-list: 1.2.4
+ dev: true
+
/configstore/5.0.1:
resolution: {integrity: sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==}
engines: {node: '>=8'}
@@ -7804,7 +7870,7 @@ packages:
lodash: ^4.17.20
marko: ^3.14.4
mote: ^0.2.0
- mustache: ^4.0.1
+ mustache: ^3.0.0
nunjucks: ^3.2.2
plates: ~0.4.11
pug: ^3.0.0
@@ -9006,6 +9072,10 @@ packages:
utila: 0.4.0
dev: false
+ /dom-event-types/1.1.0:
+ resolution: {integrity: sha512-jNCX+uNJ3v38BKvPbpki6j5ItVlnSqVV6vDWGS6rExzCMjsc39frLjm1n91o6YaKK6AZl0wLloItW6C6mr61BQ==}
+ dev: true
+
/dom-serializer/0.2.2:
resolution: {integrity: sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==}
dependencies:
@@ -9134,6 +9204,16 @@ packages:
tweetnacl: 1.0.3
dev: false
+ /editorconfig/0.15.3:
+ resolution: {integrity: sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==}
+ hasBin: true
+ dependencies:
+ commander: 2.20.3
+ lru-cache: 4.1.5
+ semver: 5.7.1
+ sigmund: 1.0.1
+ dev: true
+
/ee-first/1.1.1:
resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}
@@ -10256,6 +10336,14 @@ packages:
resolution: {integrity: sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==}
engines: {node: '>=0.10.0'}
+ /foreground-child/2.0.0:
+ resolution: {integrity: sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==}
+ engines: {node: '>=8.0.0'}
+ dependencies:
+ cross-spawn: 7.0.3
+ signal-exit: 3.0.7
+ dev: true
+
/forever-agent/0.6.1:
resolution: {integrity: sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==}
dev: false
@@ -11115,6 +11203,10 @@ packages:
resolution: {integrity: sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==}
dev: false
+ /html-escaper/2.0.2:
+ resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}
+ dev: true
+
/html-minifier-terser/5.1.1:
resolution: {integrity: sha512-ZPr5MNObqnV/T9akshPKbVgyOqLmy+Bxo7juKCfTfnjNniTAMdy4hz21YQqoofMBJD2kdREaqPPdThoR78Tgxg==}
engines: {node: '>=6'}
@@ -11888,6 +11980,11 @@ packages:
dependencies:
call-bind: 1.0.2
+ /is-whitespace/0.3.0:
+ resolution: {integrity: sha512-RydPhl4S6JwAyj0JJjshWJEFG6hNye3pZFBRZaTUfZFwGHxzppNaNOVgQuS/E/SlhrApuMXrpnK1EEIXfdo3Dg==}
+ engines: {node: '>=0.10.0'}
+ dev: true
+
/is-windows/1.0.2:
resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==}
engines: {node: '>=0.10.0'}
@@ -11934,6 +12031,28 @@ packages:
resolution: {integrity: sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==}
dev: false
+ /istanbul-lib-coverage/3.2.0:
+ resolution: {integrity: sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==}
+ engines: {node: '>=8'}
+ dev: true
+
+ /istanbul-lib-report/3.0.0:
+ resolution: {integrity: sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==}
+ engines: {node: '>=8'}
+ dependencies:
+ istanbul-lib-coverage: 3.2.0
+ make-dir: 3.1.0
+ supports-color: 7.2.0
+ dev: true
+
+ /istanbul-reports/3.1.5:
+ resolution: {integrity: sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==}
+ engines: {node: '>=8'}
+ dependencies:
+ html-escaper: 2.0.2
+ istanbul-lib-report: 3.0.0
+ dev: true
+
/iterall/1.3.0:
resolution: {integrity: sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg==}
dev: false
@@ -12003,6 +12122,17 @@ packages:
resolution: {integrity: sha512-/n9mNxZj/HDSrincJ6RP+L+yXbpnB8FybySBa+IjIaoH9FIxBbrbRT5XUbe8R7zuVM2AQqNMNDDqz0bzx3znOQ==}
hasBin: true
+ /js-beautify/1.14.4:
+ resolution: {integrity: sha512-+b4A9c3glceZEmxyIbxDOYB0ZJdReLvyU1077RqKsO4dZx9FUHjTOJn8VHwpg33QoucIykOiYbh7MfqBOghnrA==}
+ engines: {node: '>=10'}
+ hasBin: true
+ dependencies:
+ config-chain: 1.1.13
+ editorconfig: 0.15.3
+ glob: 7.2.3
+ nopt: 5.0.0
+ dev: true
+
/js-cookie/3.0.1:
resolution: {integrity: sha512-+0rgsUXZu4ncpPxRL+lNEptWMOWl9etvPHc/koSRp6MPwpRYAhmk0dUG00J4bxVV3r9uUzfo24wW0knS07SKSw==}
engines: {node: '>=12'}
@@ -15229,6 +15359,15 @@ packages:
engines: {node: '>=4'}
dev: false
+ /pretty/2.0.0:
+ resolution: {integrity: sha512-G9xUchgTEiNpormdYBl+Pha50gOUovT18IvAe7EYMZ1/f9W/WWMPRn+xI68yXNMUk3QXHDwo/1wV/4NejVNe1w==}
+ engines: {node: '>=0.10.0'}
+ dependencies:
+ condense-newlines: 0.2.1
+ extend-shallow: 2.0.1
+ js-beautify: 1.14.4
+ dev: true
+
/process-nextick-args/2.0.1:
resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
@@ -15282,6 +15421,10 @@ packages:
signal-exit: 3.0.7
dev: false
+ /proto-list/1.2.4:
+ resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==}
+ dev: true
+
/protocols/1.4.8:
resolution: {integrity: sha512-IgjKyaUSjsROSO8/D49Ab7hP8mJgTYcqApOqdPhLoPxAplXmkp+zRvsrSQjFn5by0rhm4VH0GAUELIPpx7B1yg==}
dev: false
@@ -16236,6 +16379,10 @@ packages:
get-intrinsic: 1.1.2
object-inspect: 1.12.2
+ /sigmund/1.0.1:
+ resolution: {integrity: sha512-fCvEXfh6NWpm+YSuY2bpXb/VIihqWA6hLsgboC+0nl71Q7N7o2eaCW8mJa/NLvQhs6jpd3VZV4UiUQlV6+lc8g==}
+ dev: true
+
/signal-exit/3.0.7:
resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==}
@@ -16905,6 +17052,15 @@ packages:
commander: 2.20.3
source-map-support: 0.5.21
+ /test-exclude/6.0.0:
+ resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==}
+ engines: {node: '>=8'}
+ dependencies:
+ '@istanbuljs/schema': 0.1.3
+ glob: 7.2.3
+ minimatch: 3.1.2
+ dev: true
+
/text-table/0.2.0:
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
dev: true
@@ -17810,6 +17966,15 @@ packages:
resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==}
dev: true
+ /v8-to-istanbul/9.0.1:
+ resolution: {integrity: sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w==}
+ engines: {node: '>=10.12.0'}
+ dependencies:
+ '@jridgewell/trace-mapping': 0.3.13
+ '@types/istanbul-lib-coverage': 2.0.4
+ convert-source-map: 1.8.0
+ dev: true
+
/valid-url/1.0.9:
resolution: {integrity: sha1-HBRHm0DxOXp1eC8RXkCGRHQzogA=}
dev: false
@@ -17933,6 +18098,98 @@ packages:
- whiskers
dev: true
+ /vite-plugin-vue2/2.0.2_lodash@4.17.21:
+ resolution: {integrity: sha512-Oo1iwc5Zo376s3MYXqS7j+KXs26EjiyWV8/dmI23SoorO3zaAgnBefR45Zme+QtM407tJ2MVq0mqfI10qA5+LQ==}
+ peerDependencies:
+ vite: ^2.0.0 || ^3.0.0
+ vue-template-compiler: ^2.2.0
+ dependencies:
+ '@babel/core': 7.18.9
+ '@babel/parser': 7.18.9
+ '@babel/plugin-proposal-class-properties': 7.18.6_@babel+core@7.18.9
+ '@babel/plugin-proposal-decorators': 7.18.2_@babel+core@7.18.9
+ '@babel/plugin-proposal-nullish-coalescing-operator': 7.18.6_@babel+core@7.18.9
+ '@babel/plugin-proposal-object-rest-spread': 7.18.9_@babel+core@7.18.9
+ '@babel/plugin-proposal-optional-chaining': 7.18.9_@babel+core@7.18.9
+ '@babel/plugin-transform-arrow-functions': 7.18.6_@babel+core@7.18.9
+ '@babel/plugin-transform-block-scoping': 7.18.9_@babel+core@7.18.9
+ '@babel/plugin-transform-computed-properties': 7.18.9_@babel+core@7.18.9
+ '@babel/plugin-transform-destructuring': 7.18.9_@babel+core@7.18.9
+ '@babel/plugin-transform-parameters': 7.18.8_@babel+core@7.18.9
+ '@babel/plugin-transform-spread': 7.18.9_@babel+core@7.18.9
+ '@babel/plugin-transform-typescript': 7.18.4_@babel+core@7.18.9
+ '@rollup/pluginutils': 4.2.1
+ '@vue/babel-helper-vue-jsx-merge-props': 1.2.1
+ '@vue/babel-preset-jsx': 1.2.4_@babel+core@7.18.9
+ '@vue/component-compiler-utils': 3.3.0_lodash@4.17.21
+ consolidate: 0.16.0_lodash@4.17.21
+ debug: 4.3.4
+ fs-extra: 10.1.0
+ hash-sum: 2.0.0
+ magic-string: 0.26.2
+ prettier: 2.7.1
+ querystring: 0.2.1
+ rollup: 2.75.6
+ slash: 3.0.0
+ source-map: 0.7.4
+ vue-template-babel-compiler: 1.2.0
+ transitivePeerDependencies:
+ - arc-templates
+ - atpl
+ - babel-core
+ - bracket-template
+ - coffee-script
+ - dot
+ - dust
+ - dustjs-helpers
+ - dustjs-linkedin
+ - eco
+ - ect
+ - ejs
+ - haml-coffee
+ - hamlet
+ - hamljs
+ - handlebars
+ - hogan.js
+ - htmling
+ - jade
+ - jazz
+ - jqtpl
+ - just
+ - liquid-node
+ - liquor
+ - lodash
+ - marko
+ - mote
+ - mustache
+ - nunjucks
+ - plates
+ - pug
+ - qejs
+ - ractive
+ - razor-tmpl
+ - react
+ - react-dom
+ - slm
+ - squirrelly
+ - supports-color
+ - swig
+ - swig-templates
+ - teacup
+ - templayed
+ - then-jade
+ - then-pug
+ - tinyliquid
+ - toffee
+ - twig
+ - twing
+ - underscore
+ - vash
+ - velocityjs
+ - walrus
+ - whiskers
+ dev: true
+
/vite/2.9.13_sass@1.54.0:
resolution: {integrity: sha512-AsOBAaT0AD7Mhe8DuK+/kE4aWYFMx/i0ZNi98hJclxb4e0OhQcZYUrvLjIaQ8e59Ui7txcvKMiJC1yftqpQoDw==}
engines: {node: '>=12.2.0'}
@@ -17958,7 +18215,7 @@ packages:
fsevents: 2.3.2
dev: true
- /vitest/0.20.2_jsdom@19.0.0+sass@1.54.0:
+ /vitest/0.20.2_mw23ezpxlxnjur3jzk6gbvzckm:
resolution: {integrity: sha512-AFXTHrwG4d2OO6SAL8WP5ZkOwLtgeF4tlrHfXFqrHc+5chNegeR53pge0lv/C4316SqJ2DbYaUBH8vh3CdF+BQ==}
engines: {node: '>=v14.16.0'}
hasBin: true
@@ -17986,6 +18243,7 @@ packages:
'@types/chai': 4.3.1
'@types/chai-subset': 1.3.3
'@types/node': 17.0.41
+ c8: 7.12.0
chai: 4.3.6
debug: 4.3.4
jsdom: 19.0.0
@@ -18319,6 +18577,28 @@ packages:
loader-utils: 1.4.0
dev: false
+ /vue-template-babel-compiler/1.2.0:
+ resolution: {integrity: sha512-CScBSX1/wCdmmZ/Lvj/63p2CCVTS0FMj0F69VRBo73CuJrjvPAPGmeNJ7D/cwt/VS2PduowRWbO8N4Zh4Z3b0g==}
+ engines: {node: '>=12.0.0'}
+ peerDependencies:
+ vue-template-compiler: ^2.6.0
+ dependencies:
+ '@babel/core': 7.18.9
+ '@babel/plugin-proposal-nullish-coalescing-operator': 7.18.6_@babel+core@7.18.9
+ '@babel/plugin-proposal-object-rest-spread': 7.18.9_@babel+core@7.18.9
+ '@babel/plugin-proposal-optional-chaining': 7.18.9_@babel+core@7.18.9
+ '@babel/plugin-transform-arrow-functions': 7.18.6_@babel+core@7.18.9
+ '@babel/plugin-transform-block-scoping': 7.18.9_@babel+core@7.18.9
+ '@babel/plugin-transform-computed-properties': 7.18.9_@babel+core@7.18.9
+ '@babel/plugin-transform-destructuring': 7.18.9_@babel+core@7.18.9
+ '@babel/plugin-transform-parameters': 7.18.8_@babel+core@7.18.9
+ '@babel/plugin-transform-spread': 7.18.9_@babel+core@7.18.9
+ '@babel/types': 7.18.9
+ deepmerge: 4.2.2
+ transitivePeerDependencies:
+ - supports-color
+ dev: true
+
/vue-template-compiler/2.6.14:
resolution: {integrity: sha512-ODQS1SyMbjKoO1JBJZojSw6FE4qnh9rIpUZn2EUT86FKizx9uH5z6uXiIrm4/Nb/gwxTi/o17ZDEGWAXHvtC7g==}
dependencies:
@@ -18839,6 +19119,11 @@ packages:
camelcase: 5.3.1
decamelize: 1.2.0
+ /yargs-parser/20.2.9:
+ resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==}
+ engines: {node: '>=10'}
+ dev: true
+
/yargs-parser/21.0.1:
resolution: {integrity: sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==}
engines: {node: '>=12'}
@@ -18860,6 +19145,19 @@ packages:
y18n: 4.0.3
yargs-parser: 18.1.3
+ /yargs/16.2.0:
+ resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==}
+ engines: {node: '>=10'}
+ dependencies:
+ cliui: 7.0.4
+ escalade: 3.1.1
+ get-caller-file: 2.0.5
+ require-directory: 2.1.1
+ string-width: 4.2.3
+ y18n: 5.0.8
+ yargs-parser: 20.2.9
+ dev: true
+
/yargs/17.5.1:
resolution: {integrity: sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==}
engines: {node: '>=12'}
diff --git a/tests/api.spec.ts b/tests/api.spec.ts
deleted file mode 100644
index fcd33812f2..0000000000
--- a/tests/api.spec.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { ApiPromise, WsProvider, Keyring } from '@polkadot/api'
-
-import { KeyringPair } from '@polkadot/keyring/types'
-
-const WS_URL = 'ws://127.0.0.1:9944'
-
-describe.skip('API TEST', (): void => {
- let api: ApiPromise
- const keyring = new Keyring({ type: 'sr25519' })
- let alice: KeyringPair
-
- beforeAll(async () => {
- const provider = new WsProvider(WS_URL)
- api = await ApiPromise.create({ provider })
- alice = keyring.createFromUri('//Alice')
- })
-
- afterAll(async () => {
- await api.disconnect()
- })
-
- it('can connect', async () => {
- const { chainSS58, chainDecimals, chainTokens } = api.registry
- expect(chainSS58).toBe(42)
- expect(chainDecimals[0]).toBe(12)
- expect(chainTokens[0]).toBe('Unit')
- })
-
- it('Alice can have a balance', async () => {
- const cb = api.query.system.account
- const arg = alice.address
- const result = await cb(arg)
- expect(result.data.free.toString()).not.toBe('0')
- })
-
- it.skip('Can remark', async () => {
- // expect(api.tx).exist();
- const cb = api.tx.system.remark
- // expect(cb).toBeDefined();
- const tx = await cb('RMRK::1.0.0::TEST').signAndSend(alice)
- expect(tx.hash.toHex()).toMatch(/^0x/)
- })
-})
diff --git a/tests/unit-testing/components/shared/BalanceInput.test.ts b/tests/unit-testing/components/shared/BalanceInput.test.ts
new file mode 100644
index 0000000000..d2b223ef68
--- /dev/null
+++ b/tests/unit-testing/components/shared/BalanceInput.test.ts
@@ -0,0 +1,115 @@
+import { mount, createLocalVue } from '@vue/test-utils'
+import Buefy from 'buefy'
+import { vi, expect, it } from 'vitest'
+
+import { units } from '@/params/constants'
+import BalanceInput from '@/components/shared/BalanceInput.vue'
+
+const localVue = createLocalVue()
+localVue.use(Buefy)
+
+let wrapper, input, options
+
+describe('BalanceInput.vue', () => {
+ vi.useFakeTimers()
+
+ beforeAll(() => {
+ wrapper = mount(BalanceInput, {
+ propsData: {
+ min: 10,
+ max: 100,
+ },
+ attachTo: document.body,
+ mocks: {
+ $t: () => '',
+ $config: {
+ prefix: 'rmrk',
+ },
+ $store: {
+ getters: {
+ currentUrlPrefix: 'rmrk',
+ },
+ },
+ },
+ localVue,
+ })
+ input = wrapper.find('[data-testid="balance-input"]')
+ options = wrapper
+ .find('[data-testid="balance-input-select"]')
+ .findAll('option')
+ })
+
+ it('should focus on input element', async () => {
+ await wrapper.vm.focusInput()
+ expect(input.element).toBe(document.activeElement)
+ })
+
+ it('should check input with html5validity', async () => {
+ await input.setValue('0')
+ expect(await wrapper.vm.checkValidity()).toBe(false)
+ await input.setValue('50')
+ expect(await wrapper.vm.checkValidity()).toBe(true)
+ await input.setValue('900')
+ expect(await wrapper.vm.checkValidity()).toBe(false)
+ })
+
+ it('should set proper value from props', async () => {
+ await wrapper.setProps({ value: 3 })
+ expect((input.element as HTMLInputElement).value).toBe('3')
+ })
+
+ it('should convert value based on unit', async () => {
+ await input.setValue('1')
+ vi.runAllTimers()
+ expect(wrapper.emitted().input).toBeTruthy()
+ expect(wrapper.emitted().input?.at(-1)).toStrictEqual([
+ '1000000000000',
+ '1',
+ ])
+ })
+
+ it('should convert value based on selected unit', async () => {
+ await options.at(6).setSelected()
+ await input.setValue('2')
+ expect(wrapper.find('option:checked').element.textContent).toBe(' Kilo ')
+ vi.runAllTimers()
+ expect(wrapper.emitted().input).toBeTruthy()
+ expect(wrapper.emitted().input?.at(-1)).toStrictEqual([
+ '2000000000000000000',
+ '2',
+ ])
+ })
+
+ it('should not calculate the unit if set calculate to false through props', async () => {
+ await options.at(5).setSelected()
+ await wrapper.setProps({ calculate: false })
+ await input.setValue('4')
+ vi.runAllTimers()
+ expect(wrapper.emitted().input).toBeTruthy()
+ expect(wrapper.emitted().input?.at(-1)).toStrictEqual([4, '4'])
+ })
+
+ it('should check if the value is invalid', async () => {
+ await wrapper.setProps({ calculate: true })
+ await input.setValue('+e-')
+ vi.runAllTimers()
+ expect(wrapper.emitted().input).toBeTruthy()
+ expect(wrapper.emitted().input?.at(-1)).toStrictEqual(['0', ''])
+ })
+
+ it('should check if the value is zero', async () => {
+ await input.setValue('0')
+ vi.runAllTimers()
+ await options.at(6).setSelected()
+ expect(wrapper.emitted().input).toBeTruthy()
+ expect(wrapper.emitted().input?.at(-1)).toStrictEqual(['0', '0'])
+ })
+
+ it.each(units)('unit "$name" should exists in select options', ({ name }) => {
+ const index = units.findIndex((unit) => unit.name === name)
+ const unitName = name === '-' ? 'KSM' : name
+
+ expect(options.length).toBe(14)
+ expect(options.at(index).element.textContent).toBe(` ${unitName} `)
+ })
+})
diff --git a/utils/mixins/prefixMixin.ts b/utils/mixins/prefixMixin.ts
index 3020fbba54..36677fc332 100644
--- a/utils/mixins/prefixMixin.ts
+++ b/utils/mixins/prefixMixin.ts
@@ -7,7 +7,7 @@ import { Component, Vue } from 'nuxt-property-decorator'
*/
@Component
export default class PrefixMixin extends Vue {
- private prefix = this.$config.prefix
+ private prefix = this.$config?.prefix
get envUrlPrefix() {
return this.prefix || 'rmrk'
diff --git a/vitest.config.js b/vitest.config.js
index 18d8901bd7..7ef9367fc1 100644
--- a/vitest.config.js
+++ b/vitest.config.js
@@ -1,9 +1,11 @@
import { defineConfig } from 'vitest/config'
import { resolve } from 'path'
+import { createVuePlugin } from 'vite-plugin-vue2'
export default defineConfig({
+ plugins: [createVuePlugin(/* options */)],
test: {
- include: ['**/?(*.)+(spec).+(ts|tsx|js)'],
+ include: ['tests/**/?(*.)+(spec|test).+(ts|tsx|js)'],
exclude: [
'**/node_modules/**',
'**/dist/**',
@@ -12,6 +14,10 @@ export default defineConfig({
],
globals: true,
environment: 'jsdom',
+ alias: [{ find: /^vue$/, replacement: 'vue/dist/vue.runtime.common.js' }],
+ coverage: {
+ reporter: ['text', 'json', 'html'],
+ },
},
resolve: {
alias: {