-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
re use security alert mock across the tests
- Loading branch information
1 parent
368489a
commit 1fae67a
Showing
4 changed files
with
111 additions
and
117 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { MockttpServer } from 'mockttp'; | ||
import { SECURITY_ALERTS_PROD_API_BASE_URL } from '../constants'; | ||
|
||
/** | ||
* Mocks a security alert validation request to the server. | ||
* | ||
* @param server - The MockttpServer instance to mock the request on. | ||
* @param request - The request payload to be validated. | ||
* @param response - The response payload to be returned. | ||
*/ | ||
export async function mockSecurityAlertValidateRequest( | ||
server: MockttpServer, | ||
request: Record<string, unknown>, | ||
response: Record<string, unknown>, | ||
): Promise<void> { | ||
await server | ||
.forPost(`${SECURITY_ALERTS_PROD_API_BASE_URL}/validate/0x1`) | ||
.withJsonBodyIncluding(request) | ||
.thenJson((response.statusCode as number) ?? 201, response); | ||
} |