oasis.js icon indicating copy to clipboard operation
oasis.js copied to clipboard

RPC input validation

Open armaniferrante opened this issue 5 years ago • 0 comments

Given I'm a developer, When I call an Oasis Service rpc method with an invalid input, Then I should receive a useful error.

Potential test cases:

  
  it('throws an exception when the incorrect type is given to an rpc', async () => {
    // Given.
    let service = new Service(idl);

    // When.
    let input1 = defType();
    let input2 = 'hi';
    let promise = service.rpc.the(input1, input2);

    // Then.
    return expect(promise).rejects.toEqual(
      new Error(`Invalid arguments ${JSON.stringify([input1, input2])}`)
    );
  });

  • [ ] Validate RPC arguments
  • [ ] Validate deploy arguments

armaniferrante avatar Apr 25 '19 20:04 armaniferrante