Skip to content

Commit 6b29036

Browse files
committed
Refactor dialogservice test mocks for consistency and clarity
1 parent 8990c34 commit 6b29036

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/core/test/units/dialogservice.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('dialogservice', () => {
5151
});
5252

5353
it('loads only valid dialog contributions', async () => {
54-
getContributionsMock.mockReturnValue([
54+
(getContributionsMock as any).mockReturnValue([
5555
{ id: 'valid', label: 'Valid', component: () => ({}), onButton: vi.fn() },
5656
{ id: 'no-component', onButton: vi.fn() },
5757
{ id: 'no-handler', component: () => ({}) },
@@ -66,15 +66,15 @@ describe('dialogservice', () => {
6666
});
6767

6868
it('throws on opening unknown dialog', async () => {
69-
getContributionsMock.mockReturnValue([]);
69+
(getContributionsMock as any).mockReturnValue([]);
7070
const { dialogService } = await import('../../src/core/dialogservice');
7171
await expect(dialogService.open('missing')).rejects.toThrow('Dialog "missing" not found');
7272
});
7373

7474
it('reloads contributions on dialog target change events', async () => {
7575
const validA = { id: 'a', label: 'A', component: () => ({}), onButton: vi.fn() };
7676
const validB = { id: 'b', label: 'B', component: () => ({}), onButton: vi.fn() };
77-
getContributionsMock.mockReturnValueOnce([validA]).mockReturnValue([validB]);
77+
(getContributionsMock as any).mockReturnValueOnce([validA]).mockReturnValue([validB]);
7878

7979
const { dialogService } = await import('../../src/core/dialogservice');
8080
expect(dialogService.hasDialog('a')).toBe(true);
@@ -93,7 +93,7 @@ describe('dialogservice', () => {
9393

9494
it('ignores contribution change events for non-dialog targets', async () => {
9595
const validA = { id: 'a', label: 'A', component: () => ({}), onButton: vi.fn() };
96-
getContributionsMock.mockReturnValue([validA]);
96+
(getContributionsMock as any).mockReturnValue([validA]);
9797
const { dialogService } = await import('../../src/core/dialogservice');
9898
expect(dialogService.hasDialog('a')).toBe(true);
9999

0 commit comments

Comments
 (0)