console.log("Tests initializing.") window.testSuites = []; await import ("./state/state.test.js") window.randomName = function randomName(prefix) { const sanitizedPrefix = prefix.toLowerCase().replace(/[^a-z0-9]/g, ''); // Generate a random suffix using numbers and lowercase letters const suffixLength = 8; // You can adjust the length of the suffix const suffixChars = 'abcdefghijklmnopqrstuvwxyz0123456789'; let suffix = ''; for (let i = 0; i < suffixLength; i++) { suffix += suffixChars.charAt(Math.floor(Math.random() * suffixChars.length)); } // Combine the prefix and suffix with a hyphen return `${sanitizedPrefix}-${suffix}`; } window.test = async function() { // window.testSuites.sort(); window.alert = () => true; window.confirm = () => true; let failed = 0; let success = 0; var start = new Date(); for(let j=0; j 0) { for(let i=0; i < spaceNum; i++) { spaces += " " } } console.log(`%c ${fail}${spaces}`, 'border-bottom: 2px solid #e9c9a0; color: rgb(254, 62, 43); border-radius: 10px; padding: 10px'); } else { success++; console.log(`%c${testNum}. ${test}`, 'border-bottom: 2px solid #e9c9a0; background: #628c60; color: transparent; border-radius: 10px; padding: 0px 10px 0px 10px'); } } // Need to flush ws buffer since saving is disabled, and that is what usually does the flushing // Frame.ws.sendMessage('Flush Buffer'); } // await wait(100); } console.log("") console.log("") let elapsed = new Date() - start; if(failed === 0) { console.log(`%cRan ${failed+success} tests in ${elapsed}ms`, 'color: #9cd499ff'); console.log(`%c ${success} passed`, 'color: #9cd499ff'); console.log(` ${failed} failed`); } else { console.log(`%cRan ${failed+success} tests in ${elapsed}ms`, 'color: rgb(254, 62, 43)'); console.log(`%c ${success} `, 'color: #9cd499ff', "passed"); console.log(`%c ${failed} failed`, 'color: rgb(254, 62, 43)'); } } window.wait = ms => new Promise(res => setTimeout(res, ms)); window.__defineGetter__("test", test); window.test