Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienos.com/blob/main/scripts/test-allen-intro.cjs # aienos.com Source of www.aienos.com, served from my own hardware Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienos.com / scripts / test-allen-intro.cjs` 20 lines ยท 1215 bytes Raw Blame History 1 // The retained URL must be safe for older cached HTML, including a stored Yes. 2 const {readFileSync} = require('node:fs'); 3 const vm = require('node:vm'); 4 const assert = require('node:assert/strict'); 5 const {test} = require('node:test'); 6 const source = readFileSync(process.argv[2] || 'public/js/allen-intro.js','utf8'); 7 for (const choice of [undefined, 'yes', 'no']) test(`retired popup stays removed for saved choice ${choice}`, () => { 8 const keys = ['aien-allen-intro-consent','aien-allen-intro-seen','aien-allen-intro-twclid']; 9 const values = new Map([['allen.key','keep-chat-memory'], ...keys.map(k=>[k,choice])]); 10 let removed = 0; 11 const storage = {removeItem(k){values.delete(k)}}; 12 const document = {getElementById(){return {remove(){removed++}}}, querySelectorAll(){return [{remove(){removed++}}]}}; 13 const context = {document, localStorage:storage, sessionStorage:storage, fetch(){assert.fail('must not make a request')}, window:{}}; 14 vm.runInNewContext(source, context); 15 assert.equal(removed,2); 16 assert.equal(values.get('allen.key'),'keep-chat-memory'); 17 keys.forEach(k=>assert.ok(!values.has(k))); 18 assert.equal(context.window.twq,undefined); 19 assert.ok(!source.includes('uwt.js')); 20 });