caelum0x e65158ec48 docs: add product screenshots + walkthrough video; fix live-chain config detection
- 12 screenshots (1280x720) of the dApp across all domains + 3.3-min walkthrough.mp4
- README: live deployment section with Etherscan link + screenshot grid
- fix: web resolves core contract addresses from bundled manifest (browser bundle
  can't fs-read shared CONTRACTS) -> live Ethereum Sepolia deployment now detected
- copy: 'Base Sepolia' -> 'Ethereum Sepolia' across web UI

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-01 14:45:41 +03:00

56 lines
2.1 KiB
TypeScript

/**
* /admin route tests — status, non-secret config projection, and table counts.
*/
import { describe, expect, it } from 'vitest';
import adminPlugin from '../../src/routes/admin.js';
import { buildApp, makeDb, type Row } from '../routers-kit.js';
describe('admin router', () => {
it('reports status with a reachable chain and configured db', async () => {
const app = await buildApp(adminPlugin, { db: makeDb() });
const res = await app.inject({ method: 'GET', url: '/admin/status' });
expect(res.statusCode).toBe(200);
const data = res.json().data;
expect(data.chain.reachable).toBe(true);
expect(data.chain.blockNumber).toBe('1');
expect(data.db.configured).toBe(true);
expect(data.indexer.cursors).toBe(0);
await app.close();
});
it('computes the indexer max block from cursors', async () => {
const seeded: Record<string, readonly Row[]> = {
indexer_cursors: [
{ key: 'A', last_block: '100' },
{ key: 'B', last_block: '250' },
],
};
const app = await buildApp(adminPlugin, { db: makeDb(seeded) });
const res = await app.inject({ method: 'GET', url: '/admin/status' });
expect(res.json().data.indexer.maxBlock).toBe('250');
expect(res.json().data.indexer.cursors).toBe(2);
await app.close();
});
it('exposes non-secret config only', async () => {
const app = await buildApp(adminPlugin, { db: makeDb() });
const res = await app.inject({ method: 'GET', url: '/admin/config' });
const data = res.json().data;
expect(data.chainId).toBe(11_155_111);
expect(data.supabaseConfigured).toBe(false);
expect(JSON.stringify(data)).not.toContain('SERVICE_ROLE');
await app.close();
});
it('returns read-model table counts', async () => {
const seeded: Record<string, readonly Row[]> = {
suppliers: [{ id: 's1' }, { id: 's2' }],
};
const app = await buildApp(adminPlugin, { db: makeDb(seeded) });
const res = await app.inject({ method: 'GET', url: '/admin/tables' });
expect(res.json().data.suppliers).toBe(2);
expect(res.json().data.deals).toBe(0);
await app.close();
});
});