mirror of
https://github.com/Gitlawb/openclaude.git
synced 2026-11-06 20:58:14 -04:00
test: restore real ColorPicker and CustomSelect exports after wizard step tests (TA-001 round 2) (#2340)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { PassThrough } from 'node:stream'
|
||||
|
||||
import { afterEach, beforeEach, expect, mock, test } from 'bun:test'
|
||||
import { afterAll, afterEach, beforeEach, expect, mock, test } from 'bun:test'
|
||||
import React, { useEffect } from 'react'
|
||||
import stripAnsi from 'strip-ansi'
|
||||
|
||||
@@ -8,6 +8,15 @@ import { Box, createRoot, Text } from '../../../../ink.js'
|
||||
import { WizardProvider, useWizard } from '../../../wizard/index.js'
|
||||
import type { AgentWizardData } from '../types.js'
|
||||
|
||||
// Copy real exports before mock.module can replace live module bindings.
|
||||
const nonce = `${Date.now()}-${Math.random()}`
|
||||
const realColorPicker = {
|
||||
...await import(`../../ColorPicker.js?real=${nonce}`),
|
||||
}
|
||||
const realSelect = {
|
||||
...await import(`../../../CustomSelect/select.js?real=${nonce}`),
|
||||
}
|
||||
|
||||
type ColorPickerProps = {
|
||||
onConfirm: (color: string | undefined) => void
|
||||
}
|
||||
@@ -160,6 +169,12 @@ afterEach(() => {
|
||||
}
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
// mock.restore() does not remove Bun module mock registrations.
|
||||
mock.module('../../ColorPicker.js', () => realColorPicker)
|
||||
mock.module('../../../CustomSelect/select.js', () => realSelect)
|
||||
})
|
||||
|
||||
test('ColorStep does not create a final agent when required wizard data is missing', async () => {
|
||||
const { ColorStep } =
|
||||
await importFreshStep<typeof import('./ColorStep.js')>('./ColorStep.js')
|
||||
|
||||
Reference in New Issue
Block a user