open-nav
    Preparing search index...

    Interface MockServerOptions

    interface MockServerOptions {
        credentials: MockCredentials;
        host?: string;
        inboundInvoices?: InvoiceData[];
        now?: () => Date;
        pollsBeforeDone?: number;
        port?: number;
        taxpayers?: MockTaxpayer[];
        throttle?: {
            retryAfterSeconds?: number;
            status?: 429 | 503;
            times: number;
        };
        validate?: boolean;
    }
    Index
    credentials: MockCredentials

    Credentials the mock accepts. Anything else is INVALID_SECURITY_USER.

    host?: string
    inboundInvoices?: InvoiceData[]

    Invoices issued to this taxpayer, answered by an INBOUND query.

    Submitting an invoice makes it outbound; there is no way to receive one, so inbound invoices are seeded here.

    now?: () => Date

    Injectable clock.

    pollsBeforeDone?: number

    Polls before a transaction settles. 0 means immediately.

    port?: number

    Port to listen on. 0, the default, picks a free one.

    taxpayers?: MockTaxpayer[]

    Taxpayers queryTaxpayer knows about.

    throttle?: { retryAfterSeconds?: number; status?: 429 | 503; times: number }

    Turn away the first N HTTP requests with a throttle response, so a client's retry and backoff can be exercised end to end. NAV rate limits per taxpayer, and a bulk download makes one request per invoice, so recovering from a throttle is the difference between a pull that finishes and one that dies partway.

    Type Declaration

    • OptionalretryAfterSeconds?: number

      Seconds to advertise in a Retry-After header, if any.

    • Optionalstatus?: 429 | 503

      Status to answer with. 429 (Too Many Requests) by default; 503 also retried.

    • times: number

      How many requests to turn away before serving normally.

    validate?: boolean

    Validate submitted invoices and abort the invalid ones. Default true.