feat(desktop): embed BoosAPI Desktop client as a subproject
Vendor the rebranded BoosAPI Desktop client (Tauri + Vue) into metapi as a monorepo subdirectory under desktop/. Source only — node_modules, dist, Cargo target and the upstream .git history are excluded. desktop/ keeps its own independent Cargo workspace (desktop/src-tauri with crates/*); it is not part of the backend boosapi crate, so a `cargo check` at the metapi root still compiles only the backend. Build the desktop app from desktop/src-tauri per desktop/README.md. Note: app icons are still placeholder assets pending the final BoosAPI logo. The updater signing keys live outside the repo and are not included.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { createRafScheduler } from '../src/utils/raf'
|
||||
|
||||
describe('createRafScheduler', () => {
|
||||
it('schedules and cancels using global time source', async () => {
|
||||
const calls: Array<{ cb: FrameRequestCallback, id: number }> = []
|
||||
let nextId = 1
|
||||
|
||||
const origRaf = (globalThis as any).requestAnimationFrame
|
||||
const origCancel = (globalThis as any).cancelAnimationFrame
|
||||
|
||||
;(globalThis as any).requestAnimationFrame = (cb: FrameRequestCallback) => {
|
||||
const id = nextId++
|
||||
calls.push({ cb, id })
|
||||
return id
|
||||
}
|
||||
;(globalThis as any).cancelAnimationFrame = (id: number) => {
|
||||
const idx = calls.findIndex(c => c.id === id)
|
||||
if (idx !== -1)
|
||||
calls.splice(idx, 1)
|
||||
}
|
||||
|
||||
try {
|
||||
const s = createRafScheduler()
|
||||
let fired = false
|
||||
s.schedule('update', () => {
|
||||
fired = true
|
||||
})
|
||||
// find scheduled call and invoke
|
||||
expect(calls.length).toBe(1)
|
||||
const call = calls[0]
|
||||
// invoking should call cb
|
||||
call.cb(123)
|
||||
// simulate that the time source would have removed the entry when executed
|
||||
calls.splice(0, 1)
|
||||
expect(fired).toBe(true)
|
||||
|
||||
// schedule and then cancel
|
||||
s.schedule('diff', () => {
|
||||
throw new Error('should not run')
|
||||
})
|
||||
expect(calls.length).toBe(1)
|
||||
s.cancel('diff')
|
||||
// cancelled
|
||||
expect(calls.length).toBe(0)
|
||||
}
|
||||
finally {
|
||||
;(globalThis as any).requestAnimationFrame = origRaf
|
||||
;(globalThis as any).cancelAnimationFrame = origCancel
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user