From 59153633b884c1e1d9c1fbc1df54379da67240fd Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sat, 22 Jun 2019 09:12:31 +0200 Subject: [PATCH] adding test for bot UAs --- js/test/InitialCheck.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 js/test/InitialCheck.js diff --git a/js/test/InitialCheck.js b/js/test/InitialCheck.js new file mode 100644 index 00000000..30aba1a0 --- /dev/null +++ b/js/test/InitialCheck.js @@ -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( + '', + {'userAgent': prefix + botBit + suffix} + ); + var result1 = $.PrivateBin.InitialCheck.init(), + result2 = !$('#errormessage').hasClass('hidden'); + clean(); + return result1 && result2; + } + ); + }); +}); +