mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-10-01 01:26:10 -04:00
adding test for bot UAs
This commit is contained in:
parent
d0365faf76
commit
59153633b8
31
js/test/InitialCheck.js
Normal file
31
js/test/InitialCheck.js
Normal file
@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
var common = require('../common');
|
||||
|
||||
describe('InitialCheck', function () {
|
||||
describe('init', function () {
|
||||
this.timeout(30000);
|
||||
before(function () {
|
||||
cleanup();
|
||||
});
|
||||
|
||||
jsc.property(
|
||||
'returns false and shows error, if a bot UA is detected',
|
||||
'string',
|
||||
jsc.elements(['Bot', 'bot']),
|
||||
'string',
|
||||
function (
|
||||
prefix, botBit, suffix
|
||||
) {
|
||||
const clean = jsdom(
|
||||
'<html><body><div id="errormessage" class="hidden"></div></body></html>',
|
||||
{'userAgent': prefix + botBit + suffix}
|
||||
);
|
||||
var result1 = $.PrivateBin.InitialCheck.init(),
|
||||
result2 = !$('#errormessage').hasClass('hidden');
|
||||
clean();
|
||||
return result1 && result2;
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user