A builder to allow defining rules that will mock IPFS add requests.

Hierarchy

  • AddRuleBuilder

Constructors

  • This builder should not be constructed directly. Call mockNode.forAdd() or mockNode.forAddIncluding(content) instead.

    Parameters

    • contentMatchers: undefined | ContentDefinition[]
    • addRuleCallback: ((data: RequestRuleData) => Promise<void>)
        • (data: RequestRuleData): Promise<void>
        • Parameters

          • data: RequestRuleData

          Returns Promise<void>

    Returns AddRuleBuilder

Methods

  • Return a successful result, as if the content was published to IPFS, and returning mock CID values.

    This method completes the rule definition, and returns a promise that resolves once the rule is active.

    Returns Promise<void>

  • Return a successful result, as if the content was published to IPFS, and returning a given fixed mock CID value, array of values, or full array of { Name, Hash, Size } results.

    This method completes the rule definition, and returns a promise that resolves once the rule is active.

    Parameters

    • result: string | (string | {
          Hash: string;
          Name: string;
          Size?: number;
      })[]

    Returns Promise<void>

  • Close the connection immediately after receiving the matching request, without sending any response.

    This method completes the rule definition, and returns a promise that resolves once the rule is active.

    Returns Promise<void>

  • Timeout, accepting the request but never returning a response.

    This method completes the rule definition, and returns a promise that resolves once the rule is active.

    Returns Promise<void>

Generated using TypeDoc