Function setDeployContext

  • Emulate a deployment context by giving the write access to all contracts as well a emulating a deployment for all of them.

    Remarks

    By default, the context as already callStack that emulates a deployment but has not write access. This function ensure that both are set.

    The deployment emulation is done by modifying the call stack to have different caller and callee addresses.

    If the given callerAddress is the same as the current contract address in the call stack, it is ignored to generate a different one.

    Example

    test('test constructor function', () => {
    setDeployContext();

    const mockValue: StaticArray<u8> = [1,2,3];
    const res = constructor(NoArgs.serialize());

    expect(res).toBe(mockValue);
    });

    Parameters

    • Optional callerAddress: string

      the optional caller address to use for the deployment emulation

    Returns void

Generated using TypeDoc