Documentation
    Preparing search index...

    Type Alias MockValueService

    MockValueService: MockService<MockValueState> & {
        approveNext(approved: boolean): void;
        failTransfer(transferId: string, error?: string): boolean;
        settle(transferId?: string): string[];
    }

    The value mock service type.

    Type Declaration

    • approveNext: function
      • Queue the consent decision for the next value.send.

        Parameters

        • approved: boolean

          true to approve, false to cancel as the user.

        Returns void

    • failTransfer: function
      • Fail a pending transfer with the given error, pushing value.status.changed.

        Parameters

        • transferId: string

          Transfer to fail.

        • Optionalerror: string

          Error reason, e.g. payment failed.

        Returns boolean

        Whether a pending transfer was failed.

    • settle: function
      • Settle pending transfers (all when transferId is omitted), pushing value.status.changed to the owning window.

        Parameters

        • OptionaltransferId: string

          A single transfer to settle.

        Returns string[]

        Transfer ids that were settled.

    const value = createMockValueService();
    value.approveNext(true);
    value.settle();