Преглед на файлове

adding test for bot UAs

El RIDO преди 7 години
родител
ревизия
59153633b8
променени са 1 файла, в които са добавени 31 реда и са изтрити 0 реда
  1. 31 0
      js/test/InitialCheck.js

+ 31 - 0
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(
+                    '<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;
+            }
+        );
+    });
+});
+