Skip to content

Commit 2ba2936

Browse files
easonliang28easonLiangWorldedtech
authored andcommitted
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 81d16f3 commit 2ba2936

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
@@ -3290,8 +3290,8 @@ describe("DiffViewProvider", () => {
32903290
await gate
32913291
})
32923292
diffViewProvider["closeOwnDiffView"] = closeOwnDiffView
3293-
;(diffViewProvider as any).relPath = "old.ts"
3294-
;(diffViewProvider as any).isEditing = true
3293+
diffViewProvider["relPath"] = "old.ts"
3294+
diffViewProvider.isEditing = true
32953295

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

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

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

0 commit comments

Comments
 (0)