-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref: ISSUE-13805 Signed-off-by: Nicolas Pierre-charles <[email protected]>
- Loading branch information
1 parent
84a0527
commit 16c3cab
Showing
10 changed files
with
77 additions
and
73 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
packages/manager-react-components/src/hooks/services/mocks/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './services.handler'; | ||
export * from './services.mock'; |
67 changes: 67 additions & 0 deletions
67
packages/manager-react-components/src/hooks/services/mocks/services.handler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { ServiceDetails } from '../services.type'; | ||
import { defaultServiceResponse, servicesMockErrors } from './services.mock'; | ||
|
||
export type GetServicesMocksParams = { | ||
getServicesKo?: boolean; | ||
getDetailsServicesKo?: boolean; | ||
updateServicesKo?: boolean; | ||
deleteServicesKo?: boolean; | ||
serviceResponse?: ServiceDetails; | ||
}; | ||
|
||
export const getServicesMocks = ({ | ||
getServicesKo, | ||
getDetailsServicesKo, | ||
updateServicesKo, | ||
deleteServicesKo, | ||
serviceResponse = defaultServiceResponse, | ||
}: GetServicesMocksParams): any[] => [ | ||
{ | ||
url: '/services/:id/terminate', | ||
response: () => | ||
deleteServicesKo | ||
? { | ||
message: servicesMockErrors.delete, | ||
} | ||
: null, | ||
status: deleteServicesKo ? 500 : 200, | ||
method: 'post', | ||
api: 'v6', | ||
}, | ||
{ | ||
url: '/services/:id', | ||
response: () => | ||
updateServicesKo | ||
? { | ||
message: servicesMockErrors.update, | ||
} | ||
: null, | ||
status: updateServicesKo ? 500 : 200, | ||
method: 'put', | ||
api: 'v6', | ||
}, | ||
{ | ||
url: '/services/:id', | ||
response: () => | ||
getDetailsServicesKo | ||
? { | ||
message: servicesMockErrors.getDetails, | ||
} | ||
: serviceResponse, | ||
status: getDetailsServicesKo ? 500 : 200, | ||
method: 'get', | ||
api: 'v6', | ||
}, | ||
{ | ||
url: '/services', | ||
response: () => | ||
getServicesKo | ||
? { | ||
message: servicesMockErrors.get, | ||
} | ||
: [1234567890], | ||
status: getServicesKo ? 500 : 200, | ||
method: 'get', | ||
api: 'v6', | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/manager/apps/vrack-services/e2e/step-definitions/api.step.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters