mirror of
https://github.com/NeuralNomadsAI/CodeNomad.git
synced 2026-10-22 22:31:45 +00:00
test(ui): stub toast dismissal in the pending-compaction fixture (#1097)
## Problem Since #1096, the UI unit job on `dev` fails in two `instances-pending-compaction.test.ts` tests, with `TypeError: toast.dismiss is not a function` (also in #1096's own PR run). #1096 shows one bubble per session, so a later compaction end dismisses the session's earlier bubble. These tests end several compactions in one session. Under Node with tsx, `import toast from "solid-toast"` yields the CommonJS module object, which has no `dismiss`. The fixture replaced only `toast.custom`, so the dismissal threw. The app is not affected: Vite resolves the real `toast` function, which has `dismiss`. ## Fix The fixture also replaces `toast.dismiss` with a no-op and restores it after each test, as `session-lifecycle-signals.test.ts` already does. Test-only change. ## Validation - Reproduced on unmodified `dev` (`333d73452`): 2 of 7 tests in the file fail. - With the fix: - `instances-pending-compaction`, `compaction-notice` and `session-lifecycle-signals`: 18/18; - full UI unit suite: 1694/1694; - UI typecheck.
This commit is contained in:
parent
333d734521
commit
853b14f2f3
1 changed files with 4 additions and 1 deletions
|
|
@ -34,11 +34,13 @@ async function until(check: () => boolean) {
|
|||
}
|
||||
const originalPending = serverApi.getPendingRequests, originalWorktrees = serverApi.fetchWorktrees
|
||||
const originalClient = sdkManager.createClient
|
||||
const originalToast = toast.custom
|
||||
const originalToast = toast.custom, originalDismiss = toast.dismiss
|
||||
let sequence = 0, brokerReads = 0
|
||||
const fixtures: ReturnType<typeof harness>[] = []
|
||||
beforeEach(() => {
|
||||
toast.custom = () => "fixture-toast"
|
||||
// A later compaction end replaces the session's earlier bubble.
|
||||
toast.dismiss = () => {}
|
||||
brokerReads = 0
|
||||
serverApi.getPendingRequests = async (id, directories) => {
|
||||
brokerReads++
|
||||
|
|
@ -51,6 +53,7 @@ beforeEach(() => {
|
|||
})
|
||||
afterEach(() => {
|
||||
toast.custom = originalToast
|
||||
toast.dismiss = originalDismiss
|
||||
for (const h of fixtures.splice(0)) {
|
||||
removeInstance(h.id, { authoritative: false })
|
||||
setSessions((previous) => { const next = new Map(previous); next.delete(h.id); return next })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue