test(cordis): adapt master consumers to rc.11 config and teardown

This commit is contained in:
Shigma
2026-10-22 21:46:29 +08:00
parent 21e19d3639
commit 332a918a70
3 changed files with 21 additions and 15 deletions
@@ -57,15 +57,15 @@ describe('ui-chat Host settings', () => {
it('validates folded replies and restores the saved choice', async () => {
const ctx = new Context()
const configuration = await liveConfig(ctx, { Config, apply })
expect(plainConfig(configuration.fiber.config)).toMatchObject({ foldedReplies: 'all' })
expect(plainConfig(configuration.fiber.effectiveConfig)).toMatchObject({ foldedReplies: 'all' })
await configuration.update({ foldedReplies: 'final' })
const saved = plainConfig(configuration.fiber.config)
const saved = plainConfig(configuration.fiber.effectiveConfig)
if (typeof saved !== 'object' || saved === null) throw new Error('expected saved configuration object')
expect(saved).toMatchObject({ foldedReplies: 'final' })
await expect(configuration.update({ foldedReplies: 'none' })).rejects.toThrow()
await configuration.fiber.dispose()
const restored = await liveConfig(ctx, { Config, apply }, saved)
expect(plainConfig(restored.fiber.config)).toMatchObject({ foldedReplies: 'final' })
expect(plainConfig(restored.fiber.effectiveConfig)).toMatchObject({ foldedReplies: 'final' })
await restored.fiber.dispose()
})
@@ -1489,17 +1489,23 @@ describe('cancellation and integration teardown', () => {
const probe = registerProbe(ctx)
const session = sessions.prepare(SessionId(`shutdown-${outcome}`), { meta: { cwd: '/workspace' } })
const events: SessionEvent[] = []
ctx.effect(function* () {
const detach = sessions.enter(session)
yield () => {
detach()
detached.resolve(undefined)
}
yield ctx.on('session/event', (subject, event) => {
if (subject === session) events.push(event)
})
sessions.announce(session)
yield () => releaseSession.promise
// A dependent of a root-provided service unloads with Auto, before the root's own effects.
await ctx.plugin({
inject: ['workingDirectory'],
apply: (scope: Context) => {
scope.effect(function* () {
const detach = sessions.enter(session)
yield () => {
detach()
detached.resolve(undefined)
}
yield scope.on('session/event', (subject, event) => {
if (subject === session) events.push(event)
})
sessions.announce(session)
yield () => releaseSession.promise
})
},
})
ctx.permissionPresets.set(session, AUTO_PRESET)
const agent = agentFor(session)
+1 -1
View File
@@ -66,7 +66,7 @@ describe('Fiber configuration access', () => {
const wrapper = ctx.plugin(apply, initial)
await wrapper
const raw = { value: 2 }
wrapper.update(raw)
await wrapper.update(raw)
await wrapper.await()
expect(apply).toHaveBeenLastCalledWith(wrapper.ctx, raw)
expect(wrapper.rawConfig).toBe(raw)