All files / realm/blong-gateway browser-test.ts

100% Statements 62/62
100% Branches 4/4
100% Functions 3/3
100% Lines 62/62

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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 631x 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 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 1x 1x 1x  
import {browser} from '@feasibleone/blong';
 
/**
 * browser-test.ts — Browser platform suite for blong-gateway integration tests.
 *
 * Loads the needed browser-side realms (blong-test for HTTP dispatch,
 * blong-login for authentication helpers) and the blong-gateway realm itself.
 * Test handlers are auto-discovered from the gateway realm's browser/test/
 * layer, which routes business calls (loginTokenCreate, gateway.application.*,
 * meterprobe.*, vision.compute) through the backend HTTP adapter to the
 * server-side gateway — exercising the real Fastify ApiGateway metering plugin
 * over HTTP against real MySQL + Redis (no mocks).
 */
export default browser(blong => ({
    url: import.meta.url,
    validation: blong.type.Object(
        {
            login: blong.type.Object({}),
            gateway: blong.type.Object({}),
            testClient: blong.type.Object({
                backend: blong.type.Object({
                    namespace: blong.type.Array(blong.type.String()),
                }),
            }),
        },
        {additionalProperties: false},
    ),
    children: [
        /** blong-test: provides test dispatch + backend HTTP adapter */
        async function testClient() {
            return import('@feasibleone/blong-test/browser.ts');
        },
        /** blong-login: browser-side authentication helpers */
        async function login() {
            return import('@feasibleone/blong-login/browser.ts');
        },
        /** blong-gateway: the realm under test */
        async function gateway() {
            return import('./browser.ts');
        },
    ],
    config: {
        default: {},
        dev: {
            login: {},
            gateway: {},
        },
        integration: {
            testClient: {
                backend: {
                    // Namespaces the browser backend adapter proxies to the server
                    namespace: ['meterprobe', 'vision', 'customer', 'login', 'gateway'],
                },
            },
            login: {},
            gateway: {},
            watch: {
                test: ['test.meter.http.flow'],
            },
        },
    },
}));