Make all fields of subscriptionOpts schema optional
This commit is contained in:
@@ -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',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user