diff options
Diffstat (limited to 'web_src/js/features/repo-settings-branches.test.ts')
-rw-r--r-- | web_src/js/features/repo-settings-branches.test.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/web_src/js/features/repo-settings-branches.test.ts b/web_src/js/features/repo-settings-branches.test.ts index 32ab54e4c2..526e279723 100644 --- a/web_src/js/features/repo-settings-branches.test.ts +++ b/web_src/js/features/repo-settings-branches.test.ts @@ -2,7 +2,8 @@ import {beforeEach, describe, expect, test, vi} from 'vitest'; import {initRepoSettingsBranchesDrag} from './repo-settings-branches.ts'; import {POST} from '../modules/fetch.ts'; import {createSortable} from '../modules/sortable.ts'; -import type {SortableEvent} from 'sortablejs'; +import type {SortableEvent, SortableOptions} from 'sortablejs'; +import type Sortable from 'sortablejs'; vi.mock('../modules/fetch.ts', () => ({ POST: vi.fn(), @@ -55,9 +56,10 @@ describe('Repository Branch Settings', () => { vi.mocked(POST).mockResolvedValue({ok: true} as Response); // Mock createSortable to capture and execute the onEnd callback - vi.mocked(createSortable).mockImplementation(async (_el: Element, options) => { + vi.mocked(createSortable).mockImplementation(async (_el: Element, options: SortableOptions) => { options.onEnd(new Event('SortableEvent') as SortableEvent); - return {destroy: vi.fn()}; + // @ts-expect-error: mock is incomplete + return {destroy: vi.fn()} as Sortable; }); initRepoSettingsBranchesDrag(); |