Extract snatch selection into reusable composable (#30)

## Summary

  - add a useSnatchSelection composable that centralises snatch shortfall calculations, position filtering, and RPC memoisation
  - refactor StakeHolder.vue to consume the composable instead of reimplementing the flow inline
  - introduce Vitest config and first composable tests (useSnatchSelection.spec.ts) to cover empty/partial fills and ownership edge cases
  - wire up project tooling updates so the new tests run (jsdom dep, updated package metadata)

  ## Testing

  - cd web-app && npm install
  - npm test

resolves #24

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/30
This commit is contained in:
johba 2025-09-30 20:35:47 +02:00
parent 76d84341de
commit 26a8771848
6 changed files with 1202 additions and 311 deletions

View file

@ -9,7 +9,8 @@
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --build",
"subtree": "git subtree push --prefix dist origin gh-pages"
"subtree": "git subtree push --prefix dist origin gh-pages",
"test": "vitest"
},
"dependencies": {
"@tanstack/vue-query": "^5.64.2",
@ -35,6 +36,7 @@
"@vitejs/plugin-vue": "^5.2.1",
"@vue/tsconfig": "^0.7.0",
"gh-pages": "^6.1.1",
"jsdom": "^27.0.0",
"npm-run-all2": "^7.0.2",
"typescript": "~5.7.3",
"vite": "^6.0.11",