Skip to content

Commit fe6ff68

Browse files
committed
test(diffview): keep the open() serialization test inside the lint suppression budget
The new test added nine as-any casts, pushing DiffViewProvider.spec.ts above its suppressed no-explicit-any count; the CI lint gate reports every violation in a file once the count is exceeded, so compile went red at 6485f06. Private members now use bracket notation (the spec convention) and the structural editor/document doubles use documented double casts (AGENTS.md). No behavior change; the file's violation count is back to the suppressed baseline. Refs: Zoo-Code-Org#1991 Refs: Zoo-Code-Org#1375
1 parent 6485f06 commit fe6ff68

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

‎src/integrations/editor/__tests__/DiffViewProvider.spec.ts‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3291,8 +3291,8 @@ describe("DiffViewProvider", () => {
32913291
await gate
32923292
})
32933293
diffViewProvider["closeOwnDiffView"] = closeOwnDiffView
3294-
;(diffViewProvider as any).relPath = "old.ts"
3295-
;(diffViewProvider as any).isEditing = true
3294+
diffViewProvider["relPath"] = "old.ts"
3295+
diffViewProvider.isEditing = true
32963296

32973297
const reset = diffViewProvider.reset()
32983298
while (closeOwnDiffView.mock.calls.length === 0) {
@@ -3309,14 +3309,21 @@ describe("DiffViewProvider", () => {
33093309
edit: vi.fn().mockResolvedValue(true),
33103310
revealRange: vi.fn(),
33113311
}
3312-
vi.mocked(vscode.window).visibleTextEditors = [mockEditor as any]
3313-
vi.mocked(vscode.window.showTextDocument).mockResolvedValue(mockEditor as any)
3312+
// Structural doubles: documented double casts instead of any (AGENTS.md).
3313+
vi.mocked(vscode.window).visibleTextEditors = [mockEditor as unknown as vscode.TextEditor]
3314+
vi.mocked(vscode.window.showTextDocument).mockResolvedValue(mockEditor as unknown as vscode.TextEditor)
33143315
vi.mocked(vscode.workspace.onDidOpenTextDocument).mockImplementation((callback) => {
3315-
setTimeout(() => callback({ uri: { fsPath: `${mockCwd}/new.ts`, scheme: "file" } } as any), 0)
3316+
setTimeout(
3317+
() =>
3318+
callback({
3319+
uri: { fsPath: `${mockCwd}/new.ts`, scheme: "file" },
3320+
} as unknown as vscode.TextDocument),
3321+
0,
3322+
)
33163323
return { dispose: vi.fn() }
33173324
})
33183325
vi.mocked(vscode.window.onDidChangeVisibleTextEditors).mockReturnValue({ dispose: vi.fn() })
3319-
;(diffViewProvider as any).editType = "modify"
3326+
diffViewProvider.editType = "modify"
33203327

33213328
let openDone = false
33223329
const open = diffViewProvider.open("new.ts").then(() => {
@@ -3333,13 +3340,13 @@ describe("DiffViewProvider", () => {
33333340
// The old finalization completed before the new session claimed the provider, so
33343341
// it could neither clear the new session's flags nor claim its finalization.
33353342
expect(openDone).toBe(true)
3336-
expect((diffViewProvider as any).isEditing).toBe(true)
3337-
expect((diffViewProvider as any).relPath).toBe("new.ts")
3343+
expect(diffViewProvider.isEditing).toBe(true)
3344+
expect(diffViewProvider["relPath"]).toBe("new.ts")
33383345

33393346
// The new session is finalizable: its own reset closes it and closes its own
33403347
// diff view - the old finalization's single close did not consume it.
33413348
await diffViewProvider.reset()
3342-
expect((diffViewProvider as any).isEditing).toBe(false)
3349+
expect(diffViewProvider.isEditing).toBe(false)
33433350
expect(closeOwnDiffView).toHaveBeenCalledTimes(2)
33443351
})
33453352

0 commit comments

Comments
 (0)