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

16
web-app/vitest.config.ts Normal file
View file

@ -0,0 +1,16 @@
import { defineConfig } from 'vitest/config'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath } from 'node:url'
export default defineConfig({
plugins: [vue()],
test: {
environment: 'jsdom',
globals: true,
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})