mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
test(settings): make third-review specs conform to strict optional and misused-promise contracts
Drop the explicit-undefined base fixture exactOptionalPropertyTypes forbids (the repository trusts TypeScript at typed same-process seams — no test for an input the static interface excludes; coverage holds), and reshape the async-listener containment fixture as an unknown-returning function: the earlier inline cast was silently stripped by the staged oxlint fixer, leaving a shape the next lint pass rejects.
This commit is contained in:
@@ -228,14 +228,6 @@ describe('update', () => {
|
||||
expect(scope.get()).toEqual({ theme: 'light', fontSize: 18 })
|
||||
})
|
||||
|
||||
it('ignores an explicit undefined entry in the composition base layer', async () => {
|
||||
const { ctx } = await boot({ doc: { 'ui-theme': { theme: 'light' } } })
|
||||
const scope = ctx.settings.register(settingsNamespace('ui-theme'), ThemeSchema, {
|
||||
base: { theme: undefined, fontSize: 16 },
|
||||
})
|
||||
expect(scope.get()).toEqual({ theme: 'light', fontSize: 16 })
|
||||
})
|
||||
|
||||
it('rejects a non-object patch', async () => {
|
||||
const { ctx } = await boot()
|
||||
const scope = ctx.settings.register(settingsNamespace('ui-theme'), ThemeSchema)
|
||||
@@ -616,12 +608,13 @@ describe('third review regressions', () => {
|
||||
|
||||
it('contains an async settings/updated listener rejection and keeps other listeners running', async () => {
|
||||
const { ctx, provider } = await boot()
|
||||
// An async listener violates the event's synchronous signature (typed
|
||||
// consumers get a lint error for it), but an unlinted JS plugin can still
|
||||
// register one; the cast simulates exactly that caller.
|
||||
ctx.on('settings/updated', async () => {
|
||||
throw new Error('async listener boom')
|
||||
})
|
||||
// An async listener violates the event's synchronous signature, but an
|
||||
// unlinted JS plugin can still register one. Declaring the return as
|
||||
// unknown keeps this file's typed surface legal (unknown-returning
|
||||
// functions are assignable to void positions) while the runtime value is
|
||||
// still the rejected promise the containment guard must handle.
|
||||
const boom = (): unknown => Promise.reject(new Error('async listener boom'))
|
||||
ctx.on('settings/updated', boom)
|
||||
const second = vi.fn()
|
||||
ctx.on('settings/updated', second)
|
||||
ctx.settings.register(settingsNamespace('ui-theme'), ThemeSchema)
|
||||
|
||||
Reference in New Issue
Block a user