landing-footer.test.mjs
44 lines 2.2 KB
Raw
sha256:8915fe406161f95c1681f9469375e7bae5b28c884f00bedbdef65e4b0cd0738d docs(flow): commit FLOW-V0-SPEC.md hygiene for 7A-INT merge Human 19 hours ago
1 import { describe, it } from 'node:test';
2 import assert from 'node:assert';
3 import { readFileSync, existsSync } from 'node:fs';
4 import { fileURLToPath } from 'node:url';
5 import { dirname, join } from 'node:path';
6
7 const root = join(dirname(fileURLToPath(import.meta.url)), '..');
8 const indexHtml = readFileSync(join(root, 'web', 'index.html'), 'utf8');
9 const hubHtml = readFileSync(join(root, 'web', 'hub', 'index.html'), 'utf8');
10
11 describe('landing footer and favicon', () => {
12 it('links Discord community invite above tagline', () => {
13 const discordIdx = indexHtml.indexOf('https://discord.gg/NrtzhZtrED');
14 const taglineIdx = indexHtml.indexOf('Your notes, your data, your context.');
15 assert.ok(discordIdx !== -1 && taglineIdx !== -1 && discordIdx < taglineIdx);
16 assert.match(indexHtml, /<strong>Join the community<\/strong>/);
17 assert.match(indexHtml, /class="footer-discord-link"/);
18 });
19
20 it('uses PNG favicon on landing and hub', () => {
21 assert.ok(indexHtml.includes('href="/assets/favicon.png"'));
22 assert.ok(hubHtml.includes('href="/assets/favicon.png"'));
23 assert.ok(existsSync(join(root, 'web', 'assets', 'favicon.png')));
24 });
25
26 it('includes YouTube and X footer icons before tagline', () => {
27 const yt = indexHtml.indexOf('https://www.youtube.com/@Knowtation');
28 const x = indexHtml.indexOf('https://x.com/Knowtation1111');
29 const taglineIdx = indexHtml.indexOf('Your notes, your data, your context.');
30 assert.ok(yt !== -1 && yt < taglineIdx);
31 assert.ok(x !== -1 && x < taglineIdx);
32 assert.match(indexHtml, /class="footer-social-icons"/);
33 });
34
35 it('places Discord, YouTube, and X beside the theme toggle in the header', () => {
36 assert.match(indexHtml, /class="landing-header-start"/);
37 assert.match(indexHtml, /class="landing-header-social"/);
38 const start = indexHtml.indexOf('class="landing-header-start"');
39 const themeBtn = indexHtml.indexOf('id="theme-toggle"');
40 const social = indexHtml.indexOf('class="landing-header-social"');
41 assert.ok(start !== -1 && themeBtn > start && social > themeBtn);
42 assert.ok(indexHtml.includes('aria-label="Knowtation on YouTube"', indexHtml.indexOf('landing-header-social')));
43 });
44 });
File History 1 commit
sha256:8915fe406161f95c1681f9469375e7bae5b28c884f00bedbdef65e4b0cd0738d docs(flow): commit FLOW-V0-SPEC.md hygiene for 7A-INT merge Human 19 hours ago