InitialCheck.js 924 B

12345678910111213141516171819202122232425262728293031
  1. 'use strict';
  2. var common = require('../common');
  3. describe('InitialCheck', function () {
  4. describe('init', function () {
  5. this.timeout(30000);
  6. before(function () {
  7. cleanup();
  8. });
  9. jsc.property(
  10. 'returns false and shows error, if a bot UA is detected',
  11. 'string',
  12. jsc.elements(['Bot', 'bot']),
  13. 'string',
  14. function (
  15. prefix, botBit, suffix
  16. ) {
  17. const clean = jsdom(
  18. '<html><body><div id="errormessage" class="hidden"></div></body></html>',
  19. {'userAgent': prefix + botBit + suffix}
  20. );
  21. var result1 = $.PrivateBin.InitialCheck.init(),
  22. result2 = !$('#errormessage').hasClass('hidden');
  23. clean();
  24. return result1 && result2;
  25. }
  26. );
  27. });
  28. });