open-nav
    Preparing search index...

    Interface MockState

    Everything the mock service remembers.

    Held in memory and exposed on the server handle, so a test can assert on what was actually received rather than only on what came back.

    interface MockState {
        inbound: Map<string, StoredInvoice>;
        invoices: Map<string, StoredInvoice>;
        requestIds: Set<string>;
        requests: { body: string; operation: string; requestId: string }[];
        taxpayers: Map<string, MockTaxpayer>;
        throttled: number;
        tokens: Map<string, { issuedAt: number; spent: boolean }>;
        transactions: Map<string, StoredTransaction>;
    }
    Index
    inbound: Map<string, StoredInvoice>

    Invoices issued to this taxpayer, seeded by the test.

    invoices: Map<string, StoredInvoice>

    Invoices accepted, keyed by invoice number.

    requestIds: Set<string>

    Every requestId seen, since NAV rejects a replayed one.

    requests: { body: string; operation: string; requestId: string }[]

    Requests received, newest last, for assertions.

    taxpayers: Map<string, MockTaxpayer>

    Taxpayers the mock knows about, keyed by 8 digit core tax number.

    throttled: number

    HTTP requests turned away by the throttle, for assertions.

    tokens: Map<string, { issuedAt: number; spent: boolean }>

    Exchange tokens issued and not yet spent.

    transactions: Map<string, StoredTransaction>

    Transactions, keyed by transaction id.