test(sandbox,terminal): drop the new assertions to unknown
The ACL preparation tests match the error cause with a partial object instead of a matcher cast to unknown, and the uncancelled cleanup failure test checks the retained owner activity through the public service rather than casting the service to reach its disposal method. Refs #7869
This commit is contained in:
1 parent
690634f5e9
commit
05270c6fcb
2 files changed
+4
-5
No files matched your search
@@ -267,7 +267,7 @@ describe('windows-acl write grants (LocalSandboxProvider)', () => {
|
||||
name: 'SandboxPreparationError',
|
||||
code: 'SANDBOX_PREPARATION_FAILED',
|
||||
message: expect.stringMatching(/workspace grant failed and its cleanup also failed/u) as string,
|
||||
cause: expect.objectContaining({ errors: [mockState.addFailure, mockState.disposeFailure] }) as unknown,
|
||||
cause: { errors: [mockState.addFailure, mockState.disposeFailure] },
|
||||
})
|
||||
expect(mockState.grants).toHaveLength(2)
|
||||
} finally {
|
||||
@@ -290,7 +290,7 @@ describe('windows-acl write grants (LocalSandboxProvider)', () => {
|
||||
name: 'SandboxPreparationError',
|
||||
code: 'SANDBOX_PREPARATION_FAILED',
|
||||
message: expect.stringContaining('workspace and temp directory resolution failed') as string,
|
||||
cause: expect.objectContaining({ code: 'ENOENT' }) as unknown,
|
||||
cause: { code: 'ENOENT' },
|
||||
})
|
||||
expect(mockState.grants).toHaveLength(0)
|
||||
} finally {
|
||||
@@ -313,7 +313,7 @@ describe('windows-acl write grants (LocalSandboxProvider)', () => {
|
||||
name: 'SandboxPreparationError',
|
||||
code: 'SANDBOX_PREPARATION_FAILED',
|
||||
message: expect.stringContaining('private temp directory creation failed') as string,
|
||||
cause: expect.objectContaining({ code: 'EACCES' }) as unknown,
|
||||
cause: { code: 'EACCES' },
|
||||
})
|
||||
} finally {
|
||||
if (previous === undefined) delete process.env.TMPDIR
|
||||
|
||||
@@ -309,8 +309,7 @@ describe('TerminalSessionService ownership and lifecycle', () => {
|
||||
|
||||
await expect(ctx.terminals.spawn(owner, { type: 'cleanup-failing' })).rejects.toBe(failure)
|
||||
expect(failure).toMatchObject({ name: 'TerminalBackendCleanupError', code: 'CLEANUP_FAILED' })
|
||||
const internal = ctx.terminals as unknown as { disposeOwned(owner: Agent): Promise<void> }
|
||||
await expect(internal.disposeOwned(owner)).rejects.toThrow('failed to clean up PTY lifecycle')
|
||||
expect(ctx.terminals.hasOwnerActivity(owner)).toBe(true)
|
||||
})
|
||||
|
||||
it.each(['owner', 'service'] as const)('retains caller-triggered backend cleanup failure until %s disposal', async (scope) => {
|
||||
|
||||
Reference in new issue
Block a user