Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ds-839 block modal form submissions #517

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 41 additions & 7 deletions src/hooks/__tests__/__snapshots__/useCredentialApi.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`useAddCredentialApi should attempt an api call to add credentials: apiC
]
`;

exports[`useAddCredentialApi should handle errors while attempting to add a credential: addCredentials, error 1`] = `
exports[`useAddCredentialApi should handle errors while attempting to add a credential: addCredentials, alert error 1`] = `
[
[
{
Expand All @@ -29,6 +29,13 @@ exports[`useAddCredentialApi should handle errors while attempting to add a cred
]
`;

exports[`useAddCredentialApi should handle errors while attempting to add a credential: addCredentials, error 1`] = `
{
"isAxiosError": true,
"message": "Mock error",
}
`;

exports[`useAddCredentialApi should handle success while attempting to add a credential: addCredentials, success 1`] = `
[
[
Expand All @@ -46,6 +53,16 @@ exports[`useAddCredentialApi should handle success while attempting to add a cre
`;

exports[`useAddCredentialApi should process an API error response: callbackError 1`] = `
{
"response": {
"data": {
"message": "Dolor sit",
},
},
}
`;

exports[`useAddCredentialApi should process an API error response: callbackError, alert 1`] = `
[
[
{
Expand Down Expand Up @@ -276,7 +293,7 @@ exports[`useEditCredentialApi should attempt an api call to edit credentials: ap
]
`;

exports[`useEditCredentialApi should handle errors while attempting to edit a credential: editCredentials, error 1`] = `
exports[`useEditCredentialApi should handle errors while attempting to edit a credential: editCredentials, alert error 1`] = `
[
[
{
Expand All @@ -294,6 +311,13 @@ exports[`useEditCredentialApi should handle errors while attempting to edit a cr
]
`;

exports[`useEditCredentialApi should handle errors while attempting to edit a credential: editCredentials, error 1`] = `
{
"isAxiosError": true,
"message": "Mock error",
}
`;

exports[`useEditCredentialApi should handle success while attempting to edit a credential: editCredentials, success 1`] = `
[
[
Expand All @@ -311,6 +335,16 @@ exports[`useEditCredentialApi should handle success while attempting to edit a c
`;

exports[`useEditCredentialApi should process an API error response: callbackError 1`] = `
{
"response": {
"data": {
"message": "Dolor sit",
},
},
}
`;

exports[`useEditCredentialApi should process an API error response: callbackError, alert 1`] = `
[
[
{
Expand Down Expand Up @@ -345,7 +379,7 @@ exports[`useEditCredentialApi should process an API success response: callbackSu
]
`;

exports[`useEditCredentialApi useGetCredentialsApi should attempt an api call to retrieve credentials: apiCall 1`] = `
exports[`useGetCredentialsApi should attempt an api call to retrieve credentials: apiCall 1`] = `
[
[
"/api/v1/credentials/",
Expand All @@ -354,16 +388,16 @@ exports[`useEditCredentialApi useGetCredentialsApi should attempt an api call to
]
`;

exports[`useEditCredentialApi useGetCredentialsApi should handle errors while attempting to retrieve credentials: getCredentials, error 1`] = `
exports[`useGetCredentialsApi should handle errors while attempting to retrieve credentials: getCredentials, error 1`] = `
{
"isAxiosError": true,
"message": "Mock error",
}
`;

exports[`useEditCredentialApi useGetCredentialsApi should handle success while attempting to retrieve credentials: getCredentials, success 1`] = `{}`;
exports[`useGetCredentialsApi should handle success while attempting to retrieve credentials: getCredentials, success 1`] = `{}`;

exports[`useEditCredentialApi useGetCredentialsApi should process an API error response: callbackError 1`] = `
exports[`useGetCredentialsApi should process an API error response: callbackError 1`] = `
{
"response": {
"data": {
Expand All @@ -373,7 +407,7 @@ exports[`useEditCredentialApi useGetCredentialsApi should process an API error r
}
`;

exports[`useEditCredentialApi useGetCredentialsApi should process an API success response: callbackSuccess 1`] = `
exports[`useGetCredentialsApi should process an API success response: callbackSuccess 1`] = `
{
"data": {
"results": [
Expand Down
49 changes: 46 additions & 3 deletions src/hooks/__tests__/__snapshots__/useScanApi.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`useCreateScanApi should attempt an api call to create a scan: apiCall 1
]
`;

exports[`useCreateScanApi should handle errors while attempting to create a scan: createScans, error 1`] = `
exports[`useCreateScanApi should handle errors while attempting to create a scan: createScans, alert error 1`] = `
[
[
{
Expand All @@ -29,6 +29,13 @@ exports[`useCreateScanApi should handle errors while attempting to create a scan
]
`;

exports[`useCreateScanApi should handle errors while attempting to create a scan: createScans, error 1`] = `
{
"isAxiosError": true,
"message": "Mock error",
}
`;

exports[`useCreateScanApi should handle success while attempting to create a scan: createScans, success 1`] = `
[
[
Expand All @@ -46,6 +53,16 @@ exports[`useCreateScanApi should handle success while attempting to create a sca
`;

exports[`useCreateScanApi should process an API error response: callbackError 1`] = `
{
"response": {
"data": {
"message": "Dolor sit",
},
},
}
`;

exports[`useCreateScanApi should process an API error response: callbackError, alert 1`] = `
[
[
{
Expand Down Expand Up @@ -382,7 +399,7 @@ exports[`useRunScanApi should attempt an API call to run a scan: apiCall 1`] = `
]
`;

exports[`useRunScanApi should handle errors while attempting to run a scan: runScans, error 1`] = `
exports[`useRunScanApi should handle errors while attempting to run a scan: runScans, error alert 1`] = `
[
[
{
Expand Down Expand Up @@ -413,7 +430,23 @@ exports[`useRunScanApi should handle errors while attempting to run a scan: runS
]
`;

exports[`useRunScanApi should handle missing scan ID and trigger custom error: runScans, no ID returned 1`] = `
exports[`useRunScanApi should handle errors while attempting to run a scan: runScans, with id error 1`] = `
{
"isAxiosError": true,
"message": "Mock error",
}
`;

exports[`useRunScanApi should handle errors while attempting to run a scan: runScans, without id error 1`] = `
{
"isAxiosError": true,
"message": "Mock error",
}
`;

exports[`useRunScanApi should handle missing scan ID and trigger custom error: runScans, no ID returned 1`] = `[Error: No ID returned]`;

exports[`useRunScanApi should handle missing scan ID and trigger custom error: runScans, no ID returned, alert 1`] = `
[
[
{
Expand Down Expand Up @@ -461,6 +494,16 @@ exports[`useRunScanApi should handle success while attempting to run a scan: run
`;

exports[`useRunScanApi should process an API error response: callbackError 1`] = `
{
"response": {
"data": {
"message": "Dolor sit",
},
},
}
`;

exports[`useRunScanApi should process an API error response: callbackError, alert 1`] = `
[
[
{
Expand Down
18 changes: 16 additions & 2 deletions src/hooks/__tests__/__snapshots__/useSourceApi.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports[`useAddSourceApi should attempt an api call to add sources: apiCall 1`]
]
`;

exports[`useAddSourceApi should handle errors while attempting to add a source: addSources, error 1`] = `
exports[`useAddSourceApi should handle errors while attempting to add a source: addSources, alert error 1`] = `
[
[
{
Expand All @@ -34,6 +34,13 @@ exports[`useAddSourceApi should handle errors while attempting to add a source:
]
`;

exports[`useAddSourceApi should handle errors while attempting to add a source: addSources, error 1`] = `
{
"isAxiosError": true,
"message": "Mock error",
}
`;

exports[`useAddSourceApi should handle success while attempting to add a source: addSources, success 1`] = `
[
[
Expand Down Expand Up @@ -247,7 +254,7 @@ exports[`useEditSourceApi should attempt an api call to edit sources: apiCall 1`
]
`;

exports[`useEditSourceApi should handle errors while attempting to edit a source: editSources, error 1`] = `
exports[`useEditSourceApi should handle errors while attempting to edit a source: editSources, alert error 1`] = `
[
[
{
Expand All @@ -265,6 +272,13 @@ exports[`useEditSourceApi should handle errors while attempting to edit a source
]
`;

exports[`useEditSourceApi should handle errors while attempting to edit a source: editSources, error 1`] = `
{
"isAxiosError": true,
"message": "Mock error",
}
`;

exports[`useEditSourceApi should handle success while attempting to edit a source: editSources, success 1`] = `
[
[
Expand Down
Loading
Loading