|
|
@ -22,7 +22,15 @@ const cases = [ |
|
|
|
describe('generate gridv1 captcha', () => { |
|
|
|
describe('generate gridv1 captcha', () => { |
|
|
|
for(let captchaOptions of cases) {
|
|
|
|
for(let captchaOptions of cases) {
|
|
|
|
test(captchaOptions.name, async () => { |
|
|
|
test(captchaOptions.name, async () => { |
|
|
|
expect((await gridv1(captchaOptions))); |
|
|
|
const { captcha } = await gridv1(captchaOptions); |
|
|
|
|
|
|
|
expect(await new Promise((res, rej) => { |
|
|
|
|
|
|
|
captcha.write('/tmp/captcha.jpg', (err) => { |
|
|
|
|
|
|
|
if (err) { |
|
|
|
|
|
|
|
return rej(err); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
res(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
})); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -30,7 +38,15 @@ describe('generate gridv1 captcha', () => { |
|
|
|
describe('generate gridv2 captcha', () => { |
|
|
|
describe('generate gridv2 captcha', () => { |
|
|
|
for(let captchaOptions of cases) {
|
|
|
|
for(let captchaOptions of cases) {
|
|
|
|
test(captchaOptions.name, async () => { |
|
|
|
test(captchaOptions.name, async () => { |
|
|
|
expect((await gridv2(captchaOptions))); |
|
|
|
const { captcha } = await gridv2(captchaOptions); |
|
|
|
|
|
|
|
expect(await new Promise((res, rej) => { |
|
|
|
|
|
|
|
captcha.write('/tmp/captcha.jpg', (err) => { |
|
|
|
|
|
|
|
if (err) { |
|
|
|
|
|
|
|
return rej(err); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
res(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
})); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|