Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions packages/wiki/src/__tests__/viewer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,83 @@ describe('WikiViewer', () => {
expect(html).toContain('MemBerry Wiki');
});

it('renders the MemBerry branded header and serves the logo asset', async () => {
const page = await fetch(`http://localhost:${TEST_PORT}/wiki/_index`);
const html = await page.text();
expect(html).toContain('src="/assets/memberry-logo.png"');
expect(html).toContain('<span class="title-mem">MEM</span><span class="title-berry">BERRY</span>');
expect(html).toContain('--accent: #9b35ff;');
expect(html).toContain('.hero-aurora {');
expect(html).toContain('--hero-legacy-bg:');
expect(html).toContain('--hero-left-scrim:');
expect(html).toContain('.graph .node-logo');
expect(html).toContain('.graph svg { display: block; width: 100%; height: 676px;');
expect(html).toContain('body.graph-modal-open { overflow: hidden; }');
expect(html).toContain('.graph-wrap[open] {');
expect(html).toContain('position: fixed;');
expect(html).toContain('.graph-wrap[open] .graph svg { height: calc(100vh - 56px); }');

const logo = await fetch(`http://localhost:${TEST_PORT}/assets/memberry-logo.png`);
expect(logo.status).toBe(200);
expect(logo.headers.get('content-type')).toContain('image/png');
const bytes = new Uint8Array(await logo.arrayBuffer());
expect([...bytes.slice(0, 8)]).toEqual([137, 80, 78, 71, 13, 10, 26, 10]);

const logoHead = await fetch(`http://localhost:${TEST_PORT}/assets/memberry-logo.png`, { method: 'HEAD' });
expect(logoHead.status).toBe(200);
expect(logoHead.headers.get('content-type')).toContain('image/png');
});

it('renders ops graph nodes with the MemBerry logo asset', async () => {
const opsDir = join(tmpdir(), `amp-wiki-ops-graph-test-${Date.now()}`);
const opsPort = TEST_PORT + 1;
let opsServer: Server | null = null;

try {
await mkdir(opsDir, { recursive: true });
await writeFile(
join(opsDir, '_index.md'),
[
'# MemBerry Portal',
'',
'**2** projects · **15** entities · **32** semantic facts · **5** session entries · **4** sources',
'',
'| Project | Entities | Facts | Sessions | Last Activity |',
'| --- | ---: | ---: | ---: | --- |',
'| [[projects/alpha/_index|Alpha]] | 10 | 20 | 3 | 2026-06-07 |',
'| [[projects/beta/_index|Beta]] | 5 | 12 | 2 | 2026-06-06 |',
'',
].join('\n'),
'utf-8',
);

opsServer = await startWikiViewer({
port: opsPort,
wiki_dir: opsDir,
project_tag: 'project:test',
});

const res = await fetch(`http://localhost:${opsPort}/wiki/_index`);
expect(res.status).toBe(200);
const html = await res.text();
expect(html).toContain('2 nodes · full view');
expect(html).toContain('<a href="/wiki/_index">');
expect(html).toContain('<text class="node-label node-label-brand" x="0" y="42" text-anchor="middle">MemBerry</text>');
expect(html).toContain('<image class="node-logo" href="/assets/memberry-logo.png"');
expect(html).toContain('width="56" height="56"');
expect(html).toContain('preserveAspectRatio="xMidYMid meet"');
expect(html).toContain("if (e.key === 'Escape' && graphWrap.open) graphWrap.open = false;");
expect(html).not.toContain('dominant-baseline="central" style="user-select:none;"');
expect(html).not.toContain('<text class="node-label" x="0" y="42" text-anchor="middle">amp</text>');
} finally {
if (opsServer) {
await new Promise<void>((resolve) => opsServer!.close(() => resolve()));
}
resetViewerCache();
await rm(opsDir, { recursive: true, force: true }).catch(() => {});
}
});

it('resolves [[wikilinks]] to HTML links', async () => {
const res = await fetch(`http://localhost:${TEST_PORT}/wiki/_index`);
const html = await res.text();
Expand Down
Binary file added packages/wiki/src/assets/memberry-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/wiki/src/renderers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ export function renderProjectGraph(project: ProjectData): string {
}

lines.push('');
lines.push(' classDef project fill:#ffd400,color:#0a0a0a,stroke:#ffd400');
lines.push(' classDef project fill:#9b35ff,color:#ffffff,stroke:#9b35ff');
lines.push(' classDef sparse fill:#1a1a1a,color:#888,stroke:#2a2a2a,stroke-dasharray:3 3');
lines.push('```');

Expand Down
Loading
Loading