forked from robiveli/js-captcha
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.js
More file actions
27 lines (20 loc) · 773 Bytes
/
index.test.js
File metadata and controls
27 lines (20 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { defaults } from './jest.config';
import jCaptcha from './dist/js/index';
//let myCaptcha;
describe('initialize error', () => {
test('should throw an error if no default `.jCaptcha` element present in DOM', () => {
expect(() => {
myCaptcha = new jCaptcha();
}).toThrowError();
});
});
describe('initialize success', () => {
test('should be initialized if default `.jCaptcha` element exist', () => {
document.body.innerHTML = `<input class="jCaptcha" type="text">`;
myCaptcha = new jCaptcha();
expect(myCaptcha).toBeDefined();
});
test('should create default canvas `.jCaptchaCanvas` element', () => {
expect(document.querySelector('.jCaptchaCanvas')).toBeDefined();
});
});