oasis.js
oasis.js copied to clipboard
RPC input validation
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