Skip to content

Commit

Permalink
Remove _validate
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesLefrere committed Jul 5, 2018
1 parent 6e3b263 commit 535a68f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ describe('ContractMethod', () => {
functionName: 'myFunction',
});

sandbox.spyOn(method, '_validate');
sandbox.spyOn(method, 'validate');

expect(method.getValidatedArgs(inputValues)).toEqual([
'converted input: 1',
]);
expect(method._validate).toHaveBeenCalledWith(inputValues, method.input);
expect(method.validate).toHaveBeenCalledWith(inputValues, method.input);
});

test('Contract return values are mapped to expected output', () => {
Expand Down Expand Up @@ -140,7 +140,7 @@ describe('ContractMethod', () => {
});

sandbox.spyOn(method.constructor, '_applyDefaultValues');
sandbox.spyOn(method, '_validate');
sandbox.spyOn(method, 'validate');

const args = method.getValidatedArgs(inputValues);

Expand All @@ -150,7 +150,7 @@ describe('ContractMethod', () => {
input,
defaultValues,
);
expect(method._validate).toHaveBeenCalledWith(
expect(method.validate).toHaveBeenCalledWith(
expect.objectContaining(withDefaults),
input,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ export default class ContractMethod<
params,
defaultValues,
);
return this._validate(values);
}

_validate(inputValues?: any, params: Params = this.input) {
return validateParams(inputValues, params, this.assertValid);
return validateParams(values, params, this.assertValid);
}

/**
Expand Down Expand Up @@ -144,7 +140,7 @@ export default class ContractMethod<
params,
defaultValues,
);
this._validate(values, params);
this.validate(values, params);

return params && params.length
? this.convertInputValues(values, params)
Expand Down

0 comments on commit 535a68f

Please sign in to comment.