Ver Fonte

test: avoid timeouts in property tests reloading the environment

Since the unit tests load the real Bootstrap in ebb33eb0, every
cleanup() also reloads it, which made "passes the format the user
selected to the viewer" exceed mocha's 2 second timeout in CI, with
cleanup() in each of its 100 runs. Replacing the markup is enough, as
init() binds to the new elements, so drop the per-run cleanup there
and in the PasswordPeek property test.
El RIDO há 1 semana atrás
pai
commit
28649b967a
2 ficheiros alterados com 2 adições e 2 exclusões
  1. 1 1
      js/test/PasswordPeek.js
  2. 1 1
      js/test/TopNav.js

+ 1 - 1
js/test/PasswordPeek.js

@@ -100,7 +100,7 @@ describe('PasswordPeek', function () {
                 );
             }),
             function ([count, clicks]) {
-                globalThis.cleanup();
+                // replacing the markup is enough, init binds to the new elements
                 const ids = [];
                 for (let i = 0; i < count; ++i) {
                     ids.push('password' + i);

+ 1 - 1
js/test/TopNav.js

@@ -812,7 +812,7 @@ describe('TopNav', function () {
                 fc.assert(fc.property(
                     fc.constantFrom('plaintext', 'syntaxhighlighting', 'markdown'),
                     function (format) {
-                        cleanup();
+                        // replacing the markup is enough, init binds to the new elements
                         document.documentElement.innerHTML = formatter;
                         PrivateBin.TopNav.init();
                         const select = query('#pasteFormatter');