graasp / graasp/graasp-api

[TEST] Use nock instead of jest for captcha mocking

Open
#1,235 0 comments 0 reactions 1 assignee Claimed by @spaenleh View on GitHub
Dominant language
TypeScript
Stars
7
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Use this code in `test/utils.ts` to mock the captcha with `nock`.

```ts
export function mockCaptchaValidationOnce(action: RecaptchaActionType) {
nock('https://www.google.com').get('/recaptcha/api/siteverify').query(true).reply(200, {
success: true,
action,
score: 1,
});
}
export function mockCaptchaValidationWithScore(action: RecaptchaActionType, score: number) {
nock('https://www.google.com').get('/recaptcha/api/siteverify').query(true).reply(200, {
success: true,
action,
score,
});
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.