write the captchas to tmp in tests ref #469 !258

indiachan-spamvector
Thomas Lynch 2 years ago
parent fb57aa6fd5
commit fb5b9ddb1f
  1. 20
      lib/captcha/generators/grid.test.js
  2. 10
      lib/captcha/generators/text.test.js

@ -22,7 +22,15 @@ const cases = [
describe('generate gridv1 captcha', () => {
for(let captchaOptions of cases) {
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', () => {
for(let captchaOptions of cases) {
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();
});
}));
});
}
});

@ -14,7 +14,15 @@ describe('generate text captcha', () => {
];
for(let captchaOptions of cases) {
test(captchaOptions.name, async () => {
expect((await generateCaptcha(captchaOptions)));
const { captcha } = await generateCaptcha(captchaOptions);
expect(await new Promise((res, rej) => {
captcha.write('/tmp/captcha.jpg', (err) => {
if (err) {
return rej(err);
}
res();
});
}));
});
}
});

Loading…
Cancel
Save