Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/add vitest #198

Merged
merged 9 commits into from
Nov 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: coverage update
work-kevin-flynn committed Nov 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 4ce2c56215fdc8da7c59cc5316907dad718d9f77
11 changes: 1 addition & 10 deletions packages/bridge/coverage/coverage-summary.json

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions packages/bridge/jest-report.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<testsuites name="vitest tests" tests="4" failures="0" errors="0" time="0.656">
<testsuite name="src/__tests__/utils.test.ts" timestamp="2024-11-25T10:09:19.646Z" hostname="aelfs-MacBook-Pro.local" tests="4" failures="0" errors="0" skipped="0" time="0.0060819173">
<testcase classname="src/__tests__/utils.test.ts" name="getCaContractBase() &gt; should throw error about chain is not running" time="0.001109375">
<testsuites name="vitest tests" tests="4" failures="0" errors="0" time="3.264">
<testsuite name="src/__tests__/utils.test.ts" timestamp="2024-11-25T12:21:16.904Z" hostname="codespaces-005822" tests="4" failures="0" errors="0" skipped="0" time="0.011088224">
<testcase classname="src/__tests__/utils.test.ts" name="getCaContractBase() &gt; should throw error about chain is not running" time="0.002249502">
</testcase>
<testcase classname="src/__tests__/utils.test.ts" name="getCaContractBase() &gt; should get back contract base" time="0.0006575003">
<testcase classname="src/__tests__/utils.test.ts" name="getCaContractBase() &gt; should get back contract base" time="0.001442013">
</testcase>
<testcase classname="src/__tests__/utils.test.ts" name="getIsManagerReadOnly() &gt; should throw error about chain is not running" time="0.0002070422">
<testcase classname="src/__tests__/utils.test.ts" name="getIsManagerReadOnly() &gt; should throw error about chain is not running" time="0.00047089">
</testcase>
<testcase classname="src/__tests__/utils.test.ts" name="getIsManagerReadOnly() &gt; should return false" time="0.0032765832">
<testcase classname="src/__tests__/utils.test.ts" name="getIsManagerReadOnly() &gt; should return false" time="0.004093438">
<system-out>
intg----getIsManagerReadOnly is fail TypeError: caIns.callViewMethod is not a function
at Module.getIsManagerReadOnly [90m(/Users/aelf/Documents/Projects/aelf/aelf-web-login/packages/bridge/[39msrc/utils.ts:27:28[90m)[39m
at [90m/Users/aelf/Documents/Projects/aelf/aelf-web-login/packages/bridge/[39msrc/__tests__/utils.test.ts:46:15
at file:///Users/aelf/Documents/Projects/aelf/aelf-web-login/node_modules/[4m.pnpm[24m/@[email protected]/node_modules/[4m@vitest[24m/runner/dist/index.js:533:5
at runTest (file:///Users/aelf/Documents/Projects/aelf/aelf-web-login/node_modules/[4m.pnpm[24m/@[email protected]/node_modules/[4m@vitest[24m/runner/dist/index.js:1056:11)
at runSuite (file:///Users/aelf/Documents/Projects/aelf/aelf-web-login/node_modules/[4m.pnpm[24m/@[email protected]/node_modules/[4m@vitest[24m/runner/dist/index.js:1205:15)
at runSuite (file:///Users/aelf/Documents/Projects/aelf/aelf-web-login/node_modules/[4m.pnpm[24m/@[email protected]/node_modules/[4m@vitest[24m/runner/dist/index.js:1205:15)
at runFiles (file:///Users/aelf/Documents/Projects/aelf/aelf-web-login/node_modules/[4m.pnpm[24m/@[email protected]/node_modules/[4m@vitest[24m/runner/dist/index.js:1262:5)
at startTests (file:///Users/aelf/Documents/Projects/aelf/aelf-web-login/node_modules/[4m.pnpm[24m/@[email protected]/node_modules/[4m@vitest[24m/runner/dist/index.js:1271:3)
at run (file:///Users/aelf/Documents/Projects/aelf/aelf-web-login/node_modules/[4m.pnpm[24m/[email protected]_@types+node@22.7[email protected][email protected][email protected][email protected][email protected][email protected]/node_modules/[4mvitest[24m/dist/workers/runVmTests.js:79:7)
at runVmTests (file:///Users/aelf/Documents/Projects/aelf/aelf-web-login/node_modules/[4m.pnpm[24m/[email protected]_@types+node@22.7[email protected][email protected][email protected][email protected][email protected][email protected]/node_modules/[4mvitest[24m/dist/chunks/vm.Zr4qWzDJ.js:834:5)
at Module.getIsManagerReadOnly [90m(/workspaces/aelf-web-login/packages/bridge/[39msrc/utils.ts:27:28[90m)[39m
at [90m/workspaces/aelf-web-login/packages/bridge/[39msrc/__tests__/utils.test.ts:46:15
at file:///workspaces/aelf-web-login/node_modules/[4m.pnpm[24m/@[email protected]/node_modules/[4m@vitest[24m/runner/dist/index.js:533:5
at runTest (file:///workspaces/aelf-web-login/node_modules/[4m.pnpm[24m/@[email protected]/node_modules/[4m@vitest[24m/runner/dist/index.js:1056:11)
at runSuite (file:///workspaces/aelf-web-login/node_modules/[4m.pnpm[24m/@[email protected]/node_modules/[4m@vitest[24m/runner/dist/index.js:1205:15)
at runSuite (file:///workspaces/aelf-web-login/node_modules/[4m.pnpm[24m/@[email protected]/node_modules/[4m@vitest[24m/runner/dist/index.js:1205:15)
at runFiles (file:///workspaces/aelf-web-login/node_modules/[4m.pnpm[24m/@[email protected]/node_modules/[4m@vitest[24m/runner/dist/index.js:1262:5)
at startTests (file:///workspaces/aelf-web-login/node_modules/[4m.pnpm[24m/@[email protected]/node_modules/[4m@vitest[24m/runner/dist/index.js:1271:3)
at run (file:///workspaces/aelf-web-login/node_modules/[4m.pnpm[24m/[email protected]_@types+node@22.9[email protected][email protected][email protected][email protected][email protected][email protected]/node_modules/[4mvitest[24m/dist/workers/runVmTests.js:79:7)
at runVmTests (file:///workspaces/aelf-web-login/node_modules/[4m.pnpm[24m/[email protected]_@types+node@22.9[email protected][email protected][email protected][email protected][email protected][email protected]/node_modules/[4mvitest[24m/dist/chunks/vm.Zr4qWzDJ.js:834:5)

</system-out>
</testcase>
7 changes: 5 additions & 2 deletions packages/react/coverage/coverage-summary.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{"total": {"lines":{"total":17,"covered":16,"skipped":0,"pct":94.11},"statements":{"total":18,"covered":17,"skipped":0,"pct":94.44},"functions":{"total":3,"covered":3,"skipped":0,"pct":100},"branches":{"total":6,"covered":5,"skipped":0,"pct":83.33},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}}
,"/Users/aelf/Documents/Projects/aelf/aelf-web-login/packages/react/src/context.tsx": {"lines":{"total":17,"covered":16,"skipped":0,"pct":94.11},"functions":{"total":3,"covered":3,"skipped":0,"pct":100},"statements":{"total":18,"covered":17,"skipped":0,"pct":94.44},"branches":{"total":6,"covered":5,"skipped":0,"pct":83.33}}
{"total": {"lines":{"total":71,"covered":61,"skipped":0,"pct":85.91},"statements":{"total":75,"covered":64,"skipped":0,"pct":85.33},"functions":{"total":17,"covered":13,"skipped":0,"pct":76.47},"branches":{"total":19,"covered":15,"skipped":0,"pct":78.94},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}}
,"/workspaces/aelf-web-login/packages/react/src/context.tsx": {"lines":{"total":17,"covered":16,"skipped":0,"pct":94.11},"functions":{"total":3,"covered":3,"skipped":0,"pct":100},"statements":{"total":18,"covered":17,"skipped":0,"pct":94.44},"branches":{"total":6,"covered":5,"skipped":0,"pct":83.33}}
,"/workspaces/aelf-web-login/packages/react/src/init.ts": {"lines":{"total":20,"covered":18,"skipped":0,"pct":90},"functions":{"total":5,"covered":4,"skipped":0,"pct":80},"statements":{"total":21,"covered":19,"skipped":0,"pct":90.47},"branches":{"total":7,"covered":6,"skipped":0,"pct":85.71}}
,"/workspaces/aelf-web-login/packages/react/src/useConnectWallet.tsx": {"lines":{"total":23,"covered":16,"skipped":0,"pct":69.56},"functions":{"total":4,"covered":2,"skipped":0,"pct":50},"statements":{"total":23,"covered":16,"skipped":0,"pct":69.56},"branches":{"total":6,"covered":4,"skipped":0,"pct":66.66}}
,"/workspaces/aelf-web-login/packages/react/src/useExternalStore.tsx": {"lines":{"total":11,"covered":11,"skipped":0,"pct":100},"functions":{"total":5,"covered":4,"skipped":0,"pct":80},"statements":{"total":13,"covered":12,"skipped":0,"pct":92.3},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
}
30 changes: 15 additions & 15 deletions packages/react/jest-report.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="jest tests" tests="8" failures="0" errors="0" time="2.398">
<testsuite name="init" errors="0" failures="0" skipped="0" timestamp="2024-11-22T08:25:32" time="1.185" tests="3">
<testcase classname="init should initialize VConsole if showVconsole is true" name="init should initialize VConsole if showVconsole is true" time="0.16">
<testsuites name="jest tests" tests="8" failures="0" errors="0" time="19.826">
<testsuite name="WebLoginProvider" errors="0" failures="0" skipped="0" timestamp="2024-11-25T12:20:59" time="14.153" tests="3">
<testcase classname="WebLoginProvider should render children with provided bridgeAPI" name="WebLoginProvider should render children with provided bridgeAPI" time="0.024">
</testcase>
<testcase classname="init should not initialize VConsole if showVconsole is false" name="init should not initialize VConsole if showVconsole is false" time="0.001">
<testcase classname="WebLoginProvider should render children with provided config" name="WebLoginProvider should render children with provided config" time="3.302">
</testcase>
<testcase classname="init should call initBridge with the given options" name="init should call initBridge with the given options" time="0.001">
<testcase classname="WebLoginProvider should return null if no bridgeAPI nor config" name="WebLoginProvider should return null if no bridgeAPI nor config" time="0.002">
</testcase>
</testsuite>
<testsuite name="useExternalStore" errors="0" failures="0" skipped="0" timestamp="2024-11-22T08:25:32" time="1.496" tests="1">
<testcase classname="useExternalStore should render hook" name="useExternalStore should render hook" time="0.259">
<testsuite name="init" errors="0" failures="0" skipped="0" timestamp="2024-11-25T12:21:13" time="0.755" tests="3">
<testcase classname="init should initialize VConsole if showVconsole is true" name="init should initialize VConsole if showVconsole is true" time="0.149">
</testcase>
</testsuite>
<testsuite name="useConnectWallet" errors="0" failures="0" skipped="0" timestamp="2024-11-22T08:25:32" time="1.496" tests="1">
<testcase classname="useConnectWallet should render hook" name="useConnectWallet should render hook" time="0.26">
<testcase classname="init should not initialize VConsole if showVconsole is false" name="init should not initialize VConsole if showVconsole is false" time="0.003">
</testcase>
</testsuite>
<testsuite name="WebLoginProvider" errors="0" failures="0" skipped="0" timestamp="2024-11-22T08:25:32" time="1.5" tests="3">
<testcase classname="WebLoginProvider should render children with provided bridgeAPI" name="WebLoginProvider should render children with provided bridgeAPI" time="0.014">
<testcase classname="init should call initBridge with the given options" name="init should call initBridge with the given options" time="0.004">
</testcase>
<testcase classname="WebLoginProvider should render children with provided config" name="WebLoginProvider should render children with provided config" time="0.246">
</testsuite>
<testsuite name="useConnectWallet" errors="0" failures="0" skipped="0" timestamp="2024-11-25T12:21:14" time="0.391" tests="1">
<testcase classname="useConnectWallet should render hook" name="useConnectWallet should render hook" time="0.11">
</testcase>
<testcase classname="WebLoginProvider should return null if no bridgeAPI nor config" name="WebLoginProvider should return null if no bridgeAPI nor config" time="0.001">
</testsuite>
<testsuite name="useExternalStore" errors="0" failures="0" skipped="0" timestamp="2024-11-25T12:21:15" time="0.711" tests="1">
<testcase classname="useExternalStore should render hook" name="useExternalStore should render hook" time="0.133">
</testcase>
</testsuite>
</testsuites>