diff --git a/tests/form-parser.tests.js b/tests/form-parser.tests.js index 44ef9ab..3d32b4d 100644 --- a/tests/form-parser.tests.js +++ b/tests/form-parser.tests.js @@ -1,29 +1,29 @@ import test from 'ava'; +import jsdom from 'jsdom'; import {getLoginForm, getScore, getBestByScore, getFormInfo} from '../extension/form-parser'; test('form get a score of 10 if with a Log in button', t => { - const document = require('jsdom').jsdom(`
`); + const document = jsdom.jsdom(`
`); t.is(getScore(document.forms[0]), 10); }); test('form get a score of 10 with a Sign in button', t => { - const document = require('jsdom').jsdom(`
`); + const document = jsdom.jsdom(`
`); t.is(getScore(document.forms[0]), 10); }); test('form get a score case insensitive', t => { - const document = require('jsdom').jsdom(`
`); + const document = jsdom.jsdom(`
`); t.is(getScore(document.forms[0]), 10); }); test('form get a score of 10 if input type submit', t => { - const document = require('jsdom').jsdom(`
`); + const document = jsdom.jsdom(`
`); t.is(getScore(document.forms[0]), 10); }); - test('form get a score of 0 if form not a login or signup form', t => { - const document = require('jsdom').jsdom(`
`); + const document = jsdom.jsdom(`
`); t.is(getScore(document.forms[0]), 0); }); @@ -38,7 +38,7 @@ test('filter empty forms array', t => { }); test('get login form', t => { - const document = require('jsdom').jsdom(` + const document = jsdom.jsdom(`
@@ -59,25 +59,25 @@ test('get login form', t => { }); test('get no form if not password field in', t => { - const document = require('jsdom').jsdom(`
`); + const document = jsdom.jsdom(`
`); t.is(getLoginForm(document), null); }); test('get usefull field in form', t => { - const document = require('jsdom').jsdom(`
`); + const document = jsdom.jsdom(`
`); t.is(getFormInfo(document.forms[0]).passwordField, document.getElementById('passwordField')); t.is(getFormInfo(document.forms[0]).loginField, null); t.is(getFormInfo(document.forms[0]).button, null); }); test('test get option fields in form', t => { - const document = require('jsdom').jsdom(`
`); + const document = jsdom.jsdom(`
`); t.is(getFormInfo(document.forms[0]).loginField, document.getElementById('usernameField')); t.is(getFormInfo(document.forms[0]).button, document.getElementById('button')); }); test('test real form 1', t => { - const document = require('jsdom').jsdom(`
+ const document = jsdom.jsdom(`

Happy to see you here again