All files / realm/blong-commander test.ts

85.71% Statements 30/35
50% Branches 2/4
100% Functions 1/1
85.71% Lines 30/35

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 361x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x            
import load from '@feasibleone/blong-gogo';
import tap from 'tap';
 
import server from './index.ts';
 
/**
 * Test bootstrap for the blong-commander suite — loads the `index.ts` suite
 * (blong-server + login + core + access + commander + test layer) and runs the
 * registered test groups.
 *
 * Loaded under `microservice + integration + dev` so the shared `srv.db`
 * adapter auto-creates the suite database, syncs the schema and applies the
 * `meta/db` + `meta/dbTest` seeds (the `access-db` commander source lists
 * tables from that database). Mirrors the blong-access test bootstrap.
 */
export default async function test(intents: string[] = []) {
    const platform = await load(
        server,
        'commander',
        'commander',
        ['microservice', 'integration', 'dev', ...(process.env.CI ? ['ci'] : [])].concat(intents),
    );
    await platform.start({});
    await tap.test('blong-commander', async test => {
        await platform.test(test);
    });
    await platform.stop();
}
 
if (import.meta.main) {
    test().catch(err => {
        console.error(err);
        process.exit(1);
    });
}