Make all fields of subscriptionOpts schema optional

This commit is contained in:
Leonid Logvinov
2017-07-04 17:35:02 -07:00
parent 464c16be73
commit ea6583d47e
2 changed files with 3 additions and 4 deletions

View File

@@ -16,6 +16,5 @@ export const subscriptionOptsSchema = {
fromBlock: {$ref: '/blockParam'}, fromBlock: {$ref: '/blockParam'},
toBlock: {$ref: '/blockParam'}, toBlock: {$ref: '/blockParam'},
}, },
required: ['fromBlock', 'toBlock'],
type: 'object', type: 'object',
}; };

View File

@@ -141,14 +141,14 @@ describe('Schema', () => {
it('should validate valid subscription opts', () => { it('should validate valid subscription opts', () => {
const testCases = [ const testCases = [
{fromBlock: 42, toBlock: 'latest'}, {fromBlock: 42, toBlock: 'latest'},
{fromBlock: 42},
{},
]; ];
validateAgainstSchema(testCases, subscriptionOptsSchema); validateAgainstSchema(testCases, subscriptionOptsSchema);
}); });
it('should fail for invalid subscription opts', () => { it('should fail for invalid subscription opts', () => {
const testCases = [ const testCases = [
{}, {fromBlock: '42'},
{fromBlock: 42},
{fromBlock: 42, to: 43},
]; ];
const shouldFail = true; const shouldFail = true;
validateAgainstSchema(testCases, subscriptionOptsSchema, shouldFail); validateAgainstSchema(testCases, subscriptionOptsSchema, shouldFail);