@@ -4,49 +4,26 @@ import type { ComputedRef } from 'vue'
44
55import type { TaskItemImpl } from '@/stores/queueStore'
66import type { JobErrorDialogService } from '@/components/queue/job/useJobErrorReporting'
7- import * as jobErrorReporting from '@/components/queue/job/useJobErrorReporting'
7+ import { useJobErrorReporting } from '@/components/queue/job/useJobErrorReporting'
88
9- /**
10- * Creates a mock TaskItemImpl with an error message.
11- */
129const createTaskWithError = ( errorMessage ?: string ) : TaskItemImpl =>
1310 ( { errorMessage } ) as unknown as TaskItemImpl
1411
15- describe ( 'extractErrorMessage' , ( ) => {
16- it ( 'returns null when task is null' , ( ) => {
17- expect ( jobErrorReporting . extractErrorMessage ( null ) ) . toBeNull ( )
18- } )
19-
20- it ( 'returns null when errorMessage is undefined' , ( ) => {
21- expect (
22- jobErrorReporting . extractErrorMessage ( createTaskWithError ( ) )
23- ) . toBeNull ( )
24- } )
25-
26- it ( 'returns the error message when present' , ( ) => {
27- expect (
28- jobErrorReporting . extractErrorMessage (
29- createTaskWithError ( 'Something failed' )
30- )
31- ) . toBe ( 'Something failed' )
32- } )
33- } )
34-
3512describe ( 'useJobErrorReporting' , ( ) => {
3613 let taskState = ref < TaskItemImpl | null > ( null )
3714 let taskForJob : ComputedRef < TaskItemImpl | null >
3815 let copyToClipboard : ReturnType < typeof vi . fn >
3916 let showErrorDialog : ReturnType < typeof vi . fn >
4017 let dialog : JobErrorDialogService
41- let composable : ReturnType < typeof jobErrorReporting . useJobErrorReporting >
18+ let composable : ReturnType < typeof useJobErrorReporting >
4219
4320 beforeEach ( ( ) => {
4421 taskState = ref < TaskItemImpl | null > ( null )
4522 taskForJob = computed ( ( ) => taskState . value )
4623 copyToClipboard = vi . fn ( )
4724 showErrorDialog = vi . fn ( )
4825 dialog = { showErrorDialog }
49- composable = jobErrorReporting . useJobErrorReporting ( {
26+ composable = useJobErrorReporting ( {
5027 taskForJob,
5128 copyToClipboard,
5229 dialog
0 commit comments