@@ -3,10 +3,12 @@ import { describe, expect, it, vi } from 'vitest';
3
3
import { render } from '@testing-library/react' ;
4
4
import { ApiError , ApiResponse } from '@ovh-ux/manager-core-api' ;
5
5
import { UseQueryResult } from '@tanstack/react-query' ;
6
+ import {
7
+ VrackServicesWithIAM ,
8
+ useVrackServicesList ,
9
+ vrackServicesListMocks ,
10
+ } from '@ovh-ux/manager-network-common' ;
6
11
import { OperationMessages } from './OperationMessages.component' ;
7
- import vrackServicesList from '../../../mocks/vrack-services/get-vrack-services.json' ;
8
- import { useVrackServicesList } from '@/data/hooks' ;
9
- import { VrackServicesWithIAM } from '@/types' ;
10
12
11
13
/** Render */
12
14
@@ -17,8 +19,8 @@ const renderComponent = ({ id }: { id?: string }) => {
17
19
/** END RENDER */
18
20
19
21
/** MOCKS */
20
- vi . mock ( '@/data/hooks ' , async ( importOriginal ) => {
21
- const original : typeof import ( '@/data/hooks ' ) = await importOriginal ( ) ;
22
+ vi . mock ( '@ovh-ux/manager-network-common ' , async ( importOriginal ) => {
23
+ const original : typeof import ( '@ovh-ux/manager-network-common ' ) = await importOriginal ( ) ;
22
24
return {
23
25
...original ,
24
26
useVrackServicesList : vi . fn ( ) ,
@@ -45,7 +47,7 @@ vi.mock('react-i18next', () => ({
45
47
describe ( 'OperationMessages Component' , ( ) => {
46
48
it ( 'should display a message for all vrs which are not ready' , async ( ) => {
47
49
vi . mocked ( useVrackServicesList ) . mockReturnValue ( {
48
- data : { data : vrackServicesList } ,
50
+ data : { data : vrackServicesListMocks } ,
49
51
} as UseQueryResult < ApiResponse < VrackServicesWithIAM [ ] > , ApiError > ) ;
50
52
const { queryAllByText } = renderComponent ( { } ) ;
51
53
expect (
@@ -59,7 +61,7 @@ describe('OperationMessages Component', () => {
59
61
60
62
it ( 'should display a message for a single vrs which is in error' , async ( ) => {
61
63
vi . mocked ( useVrackServicesList ) . mockReturnValue ( {
62
- data : { data : vrackServicesList } ,
64
+ data : { data : vrackServicesListMocks } ,
63
65
} as UseQueryResult < ApiResponse < VrackServicesWithIAM [ ] > , ApiError > ) ;
64
66
const { queryAllByText } = renderComponent ( { id : 'vrs-asp-dtl-lym-wza' } ) ;
65
67
expect (
@@ -73,7 +75,7 @@ describe('OperationMessages Component', () => {
73
75
74
76
it ( 'should display a message for a single vrs which is updating' , async ( ) => {
75
77
vi . mocked ( useVrackServicesList ) . mockReturnValue ( {
76
- data : { data : vrackServicesList } ,
78
+ data : { data : vrackServicesListMocks } ,
77
79
} as UseQueryResult < ApiResponse < VrackServicesWithIAM [ ] > , ApiError > ) ;
78
80
const { queryAllByText } = renderComponent ( { id : 'vrs-ahz-9t0-7lb-b5l' } ) ;
79
81
expect (
0 commit comments