Recently Written · git

ideamine

An idea inbox for Claude Code: /idea saves ideas at zero tokens; Claude triages them and routes each to the cheapest model that can build it.

git clone https://github.com/equwal/ideamine

Log | Files | Refs


tests/dashboard.test.js (1137 bytes)

1 import assert from 'node:assert/strict';
2 import fs from 'node:fs';
3 import { test } from 'node:test';
4 import vm from 'node:vm';
5 
6 const page = fs.readFileSync(new URL('../dashboard/index.html', import.meta.url), 'utf8');
7 const script = /<script>([\s\S]*?)<\/script>/.exec(page)[1];
8 
9 test('the page script compiles, and the tabs match the views the script knows', () => {
10   assert.doesNotThrow(() => new vm.Script(script, { filename: 'dashboard/index.html' }));
11   const tabs = [...page.matchAll(/data-view="([a-z]+)"/g)].map((m) => m[1]);
12   const views = JSON.parse(/const VIEWS = (\[[^\]]*\]);/.exec(script)[1].replace(/'/g, '"'));
13   assert.deepEqual(tabs, views);
14   assert.deepEqual(tabs, ['board', 'timeline', 'table', 'projects', 'flow', 'matrix', 'groups', 'prompts', 'memory', 'usage']);
15   for (const view of views) assert.match(script, new RegExp(`state\\.view === '${view}'|else renderBoard`), `render() handles ${view}`);
16 });
17 
18 test('the page loads nothing from the internet', () => {
19   assert.doesNotMatch(page, /https?:\/\/(?!www\.w3\.org\/2000\/svg)/);
20   assert.match(page, /Content-Security-Policy[^>]*default-src 'self'/);
21 });