Skip to content

Commit 4d8b2a1

Browse files
committed
test(stable32): update showStatusInlineAction spec to mock OCA.Files.Sidebar
Adapt test setup to match the NC32-compatible sidebar implementation: - Remove getSidebar() mock (no longer used) - Add window.OCA.Files.Sidebar mock with open/setActiveTab vi.fn() - Assert sidebar calls using OCA.Files.Sidebar instead of getSidebar return value Signed-off-by: Vitor Mattos <[email protected]>
1 parent b706bc0 commit 4d8b2a1

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/tests/actions/showStatusInlineAction.spec.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,13 @@ describe('showStatusInlineAction', () => {
8383
action = capturedActionRef.value
8484

8585
// Mock window.OCA.Files.Sidebar for Nextcloud 32 compatibility
86-
if (!global.window) {
87-
global.window = {}
88-
}
8986
global.window.OCA = {
87+
Libresign: {},
9088
Files: {
9189
Sidebar: {
9290
open: vi.fn(),
9391
setActiveTab: vi.fn(),
94-
},
92+
} as OCAFilesSidebar,
9593
},
9694
}
9795
})
@@ -216,8 +214,8 @@ describe('showStatusInlineAction', () => {
216214
const node = { fileid: 123, name: 'test.pdf', path: '/test.pdf' }
217215
const result = await action.exec({ nodes: [node] })
218216

219-
expect(global.window.OCA.Files.Sidebar.open).toHaveBeenCalledWith('/test.pdf')
220-
expect(global.window.OCA.Files.Sidebar.setActiveTab).toHaveBeenCalledWith('libresign')
217+
expect(global.window.OCA.Files!.Sidebar.open).toHaveBeenCalledWith('/test.pdf')
218+
expect(global.window.OCA.Files!.Sidebar.setActiveTab).toHaveBeenCalledWith('libresign')
221219
expect(result).toBe(null)
222220
})
223221
})

0 commit comments

Comments
 (0)