fix(ajv): fix ajv validate parameter name

This commit is contained in:
SamTolmay 2020-12-08 17:23:30 +02:00
parent 09105a99b3
commit 5aba7230fe
28 changed files with 188 additions and 188 deletions

View File

@ -25,8 +25,8 @@ const ajv = new Ajv({
ajvErrors(ajv);
function validate({ schema, object, returnErrors = false }) {
const valid = ajv.validate(schema, object);
function validate({ schema, data, returnErrors = false }) {
const valid = ajv.validate(schema, data);
if (!valid) {
if (returnErrors) {
return {

View File

@ -25,10 +25,10 @@ test('Object matches schema', () => {
},
},
};
const object = {
const data = {
string: 'value',
};
expect(validate({ schema, object })).toEqual({ valid: true });
expect(validate({ schema, data })).toEqual({ valid: true });
});
test('Object does not match schema, one error', () => {
@ -40,10 +40,10 @@ test('Object does not match schema, one error', () => {
},
},
};
const object = {
const data = {
string: 7,
};
expect(() => validate({ schema, object })).toThrow('should be string');
expect(() => validate({ schema, data })).toThrow('should be string');
});
test('Object does not match schema, two errors', () => {
@ -58,11 +58,11 @@ test('Object does not match schema, two errors', () => {
},
},
};
const object = {
const data = {
string: 7,
number: '7',
};
expect(() => validate({ schema, object })).toThrow('should be string; should be number');
expect(() => validate({ schema, data })).toThrow('should be string; should be number');
});
test('Object does not match schema, three errors', () => {
@ -80,12 +80,12 @@ test('Object does not match schema, three errors', () => {
},
},
};
const object = {
const data = {
string: 7,
number: '7',
boolean: 7,
};
expect(() => validate({ schema, object })).toThrow('should be string; should be boolean');
expect(() => validate({ schema, data })).toThrow('should be string; should be boolean');
});
test('Object does not match schema, one error, error message', () => {
@ -100,10 +100,10 @@ test('Object does not match schema, one error, error message', () => {
},
},
};
const object = {
const data = {
string: 7,
};
expect(() => validate({ schema, object })).toThrow('Custom error message.');
expect(() => validate({ schema, data })).toThrow('Custom error message.');
});
test('Object does not match schema, two errors, error messages', () => {
@ -124,11 +124,11 @@ test('Object does not match schema, two errors, error messages', () => {
},
},
};
const object = {
const data = {
string: 7,
number: '7',
};
expect(() => validate({ schema, object })).toThrow('Custom error string.; Custom error number.');
expect(() => validate({ schema, data })).toThrow('Custom error string.; Custom error number.');
});
test('Object does not match schema, three errors, error messages', () => {
@ -155,12 +155,12 @@ test('Object does not match schema, three errors, error messages', () => {
},
},
};
const object = {
const data = {
string: 7,
number: '7',
boolean: 7,
};
expect(() => validate({ schema, object })).toThrow('Custom error string.; Custom error boolean.');
expect(() => validate({ schema, data })).toThrow('Custom error string.; Custom error boolean.');
});
test('Nunjucks template in error message', () => {
@ -175,10 +175,10 @@ test('Nunjucks template in error message', () => {
},
},
};
const object = {
const data = {
string: 7,
};
expect(() => validate({ schema, object })).toThrow(
expect(() => validate({ schema, data })).toThrow(
'errorMessage:/string:#/properties/string/errorMessage:{{ keyword }}:{{ dataPath }}:{{ schemaPath }}:{{ message }}'
);
});
@ -201,11 +201,11 @@ test('Nunjucks template in error message', () => {
},
},
};
const object = {
const data = {
string: 7,
number: '7',
};
expect(() => validate({ schema, object })).toThrow(
expect(() => validate({ schema, data })).toThrow(
'errorMessage:/string:#/properties/string/errorMessage:{{ keyword }}:{{ dataPath }}:{{ schemaPath }}:{{ message }}; errorMessage:/number:#/properties/number/errorMessage:{{ keyword }}:{{ dataPath }}:{{ schemaPath }}:{{ message }}'
);
});
@ -219,10 +219,10 @@ test('Object does not match schema, one error, returnErrors true', () => {
},
},
};
const object = {
const data = {
string: 7,
};
expect(validate({ schema, object, returnErrors: true })).toEqual({
expect(validate({ schema, data, returnErrors: true })).toEqual({
errors: [
{
dataPath: '/string',
@ -253,12 +253,12 @@ test('Object does not match schema, three errors, returnErrors true', () => {
},
},
};
const object = {
const data = {
string: 7,
number: '7',
boolean: 7,
};
expect(validate({ schema, object, returnErrors: true })).toEqual({
expect(validate({ schema, data, returnErrors: true })).toEqual({
errors: [
{
dataPath: '/string',
@ -304,10 +304,10 @@ test('Object does not match schema, one error, error message, returnErrors true'
},
},
};
const object = {
const data = {
string: 7,
};
expect(validate({ schema, object, returnErrors: true })).toEqual({
expect(validate({ schema, data, returnErrors: true })).toEqual({
errors: [
{
dataPath: '/string',

View File

@ -21,7 +21,7 @@ import formatErrorMessage from '../utils/formatErrorMessage';
async function testSchema({ components, context }) {
const { valid, errors } = validate({
schema: lowdefySchema,
object: components,
data: components,
returnErrors: true,
});
if (!valid) {

View File

@ -31,7 +31,7 @@ test('valid connection schema', () => {
region: 'region',
bucket: 'bucket',
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
});
test('valid connection schema, all properties', () => {
@ -43,7 +43,7 @@ test('valid connection schema, all properties', () => {
read: true,
write: true,
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
});
test('accessKeyId missing', () => {
@ -52,7 +52,7 @@ test('accessKeyId missing', () => {
region: 'region',
bucket: 'bucket',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'AwsS3Bucket connection should have required property "accessKeyId".'
);
});
@ -64,7 +64,7 @@ test('accessKeyId is not a string', () => {
region: 'region',
bucket: 'bucket',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'AwsS3Bucket connection property "accessKeyId" should be a string.'
);
});
@ -75,7 +75,7 @@ test('secretAccessKey missing', () => {
region: 'region',
bucket: 'bucket',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'AwsS3Bucket connection should have required property "secretAccessKey".'
);
});
@ -87,7 +87,7 @@ test('secretAccessKey is not a string', () => {
region: 'region',
bucket: 'bucket',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'AwsS3Bucket connection property "secretAccessKey" should be a string.'
);
});
@ -98,7 +98,7 @@ test('region missing', () => {
secretAccessKey: 'secretAccessKey',
bucket: 'bucket',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'AwsS3Bucket connection should have required property "region".'
);
});
@ -110,7 +110,7 @@ test('region is not a string', () => {
region: true,
bucket: 'bucket',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'AwsS3Bucket connection property "region" should be a string.'
);
});
@ -121,7 +121,7 @@ test('bucket missing', () => {
secretAccessKey: 'secretAccessKey',
region: 'region',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'AwsS3Bucket connection should have required property "bucket".'
);
});
@ -133,7 +133,7 @@ test('bucket is not a string', () => {
region: 'region',
bucket: true,
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'AwsS3Bucket connection property "bucket" should be a string.'
);
});
@ -146,7 +146,7 @@ test('read is not a boolean', () => {
bucket: 'bucket',
read: 'read',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'AwsS3Bucket connection property "read" should be a boolean.'
);
});
@ -159,7 +159,7 @@ test('write is not a boolean', () => {
bucket: 'bucket',
write: 'write',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'AwsS3Bucket connection property "write" should be a boolean.'
);
});

View File

@ -135,49 +135,49 @@ test('Error from s3 client', async () => {
test('Request properties is not an object', async () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'AwsS3PresignedGetObject request properties should be an object.'
);
});
test('Request key missing', async () => {
const request = {};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'AwsS3PresignedGetObject request should have required property "key".'
);
});
test('Request expires property not a number', async () => {
const request = { key: 'key', expires: 'expires' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'AwsS3PresignedGetObject request property "expires" should be a number.'
);
});
test('Request key not a string', async () => {
const request = { key: true };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'AwsS3PresignedGetObject request property "key" should be a string.'
);
});
test('Request responseContentDisposition not a string', async () => {
const request = { key: 'key', responseContentDisposition: true };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'AwsS3PresignedGetObject request property "responseContentDisposition" should be a string.'
);
});
test('Request responseContentType not a string', async () => {
const request = { key: 'key', responseContentType: true };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'AwsS3PresignedGetObject request property "responseContentType" should be a string.'
);
});
test('Request versionId not a string', async () => {
const request = { key: 'key', versionId: true };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'AwsS3PresignedGetObject request property "versionId" should be a string.'
);
});

View File

@ -137,49 +137,49 @@ test('checkWrite should be true', async () => {
test('Request properties is not an object', async () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'AwsS3PresignedPostPolicy request properties should be an object.'
);
});
test('Request property key missing', async () => {
const request = {};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'AwsS3PresignedPostPolicy request should have required property "key".'
);
});
test('Request property key not a string', async () => {
const request = { key: true };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'AwsS3PresignedPostPolicy request property "key" should be a string.'
);
});
test('Request property acl not a string', async () => {
const request = { key: 'key', acl: true };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'AwsS3PresignedPostPolicy request property "acl" is not one of "private", "public-read", "public-read-write", "aws-exec-read", "authenticated-read", "bucket-owner-read", "bucket-owner-full-control".'
);
});
test('Request property acl not an allowed value', async () => {
const request = { key: 'key', acl: 'acl' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'AwsS3PresignedPostPolicy request property "acl" is not one of "private", "public-read", "public-read-write", "aws-exec-read", "authenticated-read", "bucket-owner-read", "bucket-owner-full-control".'
);
});
test('Request property conditions not an array', async () => {
const request = { key: 'key', conditions: 'conditions' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'AwsS3PresignedPostPolicy request property "conditions" should be a array.'
);
});
test('Request property expires not a number', async () => {
const request = { key: 'key', expires: 'expires' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'AwsS3PresignedPostPolicy request property "expires" should be a number.'
);
});

View File

@ -27,7 +27,7 @@ test('valid connection schema', () => {
const connection = {
url: 'https://example.com/api',
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
});
test('valid connection schema, all properties', () => {
@ -58,14 +58,14 @@ test('valid connection schema, all properties', () => {
port: 4030,
},
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
});
test('url is not a string', () => {
const connection = {
url: true,
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'AxiosHttp property "url" should be a string.'
);
});

View File

@ -35,7 +35,7 @@ test('valid connection schema', () => {
sheetIndex: 0,
spreadsheetId: 'spreadsheetId',
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
});
test('valid connection schema, all properties', () => {
@ -47,19 +47,19 @@ test('valid connection schema, all properties', () => {
sheetIndex: 0,
spreadsheetId: 'spreadsheetId',
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
});
test('connection properties is not an object', () => {
const connection = 'connection';
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'GoogleSheet connection properties should be an object.'
);
});
test('spreadsheetId missing', () => {
const connection = {};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'GoogleSheet connection should have required property "spreadsheetId".'
);
});
@ -68,7 +68,7 @@ test('spreadsheetId is not a string', () => {
const connection = {
spreadsheetId: true,
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'GoogleSheet connection property "spreadsheetId" should be a string.'
);
});
@ -78,7 +78,7 @@ test('apiKey is not a string', () => {
spreadsheetId: 'spreadsheetId',
apiKey: true,
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'GoogleSheet connection property "apiKey" should be a string.'
);
});
@ -88,7 +88,7 @@ test('client_email is not a string', () => {
spreadsheetId: 'spreadsheetId',
client_email: true,
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'GoogleSheet connection property "client_email" should be a string.'
);
});
@ -98,7 +98,7 @@ test('private_key is not a string', () => {
spreadsheetId: 'spreadsheetId',
private_key: true,
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'GoogleSheet connection property "private_key" should be a string.'
);
});
@ -108,7 +108,7 @@ test('sheetId is not a string', () => {
spreadsheetId: 'spreadsheetId',
sheetId: true,
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'GoogleSheet connection property "sheetId" should be a string.'
);
});
@ -118,7 +118,7 @@ test('sheetIndex is not a number', () => {
spreadsheetId: 'spreadsheetId',
sheetIndex: '',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'GoogleSheet connection property "sheetIndex" should be a number.'
);
});
@ -128,7 +128,7 @@ test('columnTypes is not an object', () => {
spreadsheetId: 'spreadsheetId',
columnTypes: '',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'GoogleSheet connection property "columnTypes" should be an object.'
);
});
@ -140,7 +140,7 @@ test('columnTypes type is invalid', () => {
column: 'invalid',
},
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'GoogleSheet connection property "/columnTypes/column" should be one of "string", "number", "boolean", "date", or "json".'
);
});
@ -150,7 +150,7 @@ test('read is not a boolean', () => {
spreadsheetId: 'spreadsheetId',
read: 'read',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'GoogleSheet connection property "read" should be a boolean.'
);
});
@ -160,7 +160,7 @@ test('write is not a boolean', () => {
spreadsheetId: 'spreadsheetId',
write: 'write',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'GoogleSheet connection property "write" should be a boolean.'
);
});

View File

@ -198,7 +198,7 @@ test('valid request schema', () => {
},
],
};
expect(validate({ schema, object: request })).toEqual({ valid: true });
expect(validate({ schema, data: request })).toEqual({ valid: true });
});
test('valid request schema, all options', () => {
@ -212,12 +212,12 @@ test('valid request schema, all options', () => {
raw: true,
},
};
expect(validate({ schema, object: request })).toEqual({ valid: true });
expect(validate({ schema, data: request })).toEqual({ valid: true });
});
test('request properties is not an object', () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetAppendMany request properties should be an object.'
);
});
@ -226,7 +226,7 @@ test('rows is not an array', () => {
const request = {
rows: true,
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetAppendMany request property "rows" should be an array.'
);
});
@ -236,14 +236,14 @@ test('rows is not an array of objects', () => {
rows: [1, 2, 3],
};
// Gives an error message for each item in array
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetAppendMany request property "rows" should be an array of objects.; GoogleSheetAppendMany request property "rows" should be an array of objects.'
);
});
test('rows is missing', () => {
const request = {};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetAppendMany request should have required property "rows".'
);
});
@ -259,7 +259,7 @@ test('raw is not a boolean', () => {
raw: 'raw',
},
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetAppendMany request property "options.raw" should be a boolean.'
);
});

View File

@ -155,7 +155,7 @@ test('valid request schema', () => {
name: 'name',
},
};
expect(validate({ schema, object: request })).toEqual({ valid: true });
expect(validate({ schema, data: request })).toEqual({ valid: true });
});
test('valid request schema, all options', () => {
@ -167,12 +167,12 @@ test('valid request schema, all options', () => {
raw: true,
},
};
expect(validate({ schema, object: request })).toEqual({ valid: true });
expect(validate({ schema, data: request })).toEqual({ valid: true });
});
test('request properties is not an object', () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetAppendOne request properties should be an object.'
);
});
@ -181,14 +181,14 @@ test('row is not an object', () => {
const request = {
row: true,
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetAppendOne request property "row" should be an object.'
);
});
test('row is missing', () => {
const request = {};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetAppendOne request should have required property "row".'
);
});
@ -202,7 +202,7 @@ test('raw is not a boolean', () => {
raw: 'raw',
},
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetAppendOne request property "options.raw" should be a boolean.'
);
});

View File

@ -141,12 +141,12 @@ test('valid request schema', () => {
const request = {
filter: { id: '1' },
};
expect(validate({ schema, object: request })).toEqual({ valid: true });
expect(validate({ schema, data: request })).toEqual({ valid: true });
});
test('request properties is not an object', () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetDeleteOne request properties should be an object.'
);
});
@ -155,14 +155,14 @@ test('filter is not an object', () => {
const request = {
filter: true,
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetDeleteOne request property "filter" should be an object.'
);
});
test('filter is missing', () => {
const request = {};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetDeleteOne request should have required property "filter".'
);
});
@ -173,7 +173,7 @@ test('limit is not a number', () => {
limit: true,
},
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetDeleteOne request property "options.limit" should be a number.'
);
});
@ -184,7 +184,7 @@ test('skip is not a number', () => {
skip: true,
},
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetDeleteOne request property "options.skip" should be a number.'
);
});

View File

@ -300,7 +300,7 @@ test('googleSheetGetMany, columnTypes', async () => {
test('valid request schema', () => {
const request = {};
expect(validate({ schema, object: request })).toEqual({ valid: true });
expect(validate({ schema, data: request })).toEqual({ valid: true });
});
test('valid request schema, all properties', () => {
@ -312,12 +312,12 @@ test('valid request schema, all properties', () => {
skip: 300,
},
};
expect(validate({ schema, object: request })).toEqual({ valid: true });
expect(validate({ schema, data: request })).toEqual({ valid: true });
});
test('request properties is not an object', () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetGetMany request properties should be an object.'
);
});
@ -328,7 +328,7 @@ test('limit is not a number', () => {
limit: true,
},
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetGetMany request property "options.limit" should be a number.'
);
});
@ -339,7 +339,7 @@ test('skip is not a number', () => {
skip: true,
},
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetGetMany request property "options.skip" should be a number.'
);
});
@ -348,7 +348,7 @@ test('filter is not an object', () => {
const request = {
filter: true,
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetGetMany request property "filter" should be an object.'
);
});
@ -357,7 +357,7 @@ test('pipeline is not an array', () => {
const request = {
pipeline: true,
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetGetMany request property "pipeline" should be an array.'
);
});

View File

@ -217,7 +217,7 @@ test('googleSheetGetOne, columnTypes', async () => {
test('valid request schema', () => {
const request = {};
expect(validate({ schema, object: request })).toEqual({ valid: true });
expect(validate({ schema, data: request })).toEqual({ valid: true });
});
test('valid request schema, all properties', () => {
@ -227,12 +227,12 @@ test('valid request schema, all properties', () => {
skip: 300,
},
};
expect(validate({ schema, object: request })).toEqual({ valid: true });
expect(validate({ schema, data: request })).toEqual({ valid: true });
});
test('request properties is not an object', () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetGetOne request properties should be an object.'
);
});
@ -243,7 +243,7 @@ test('limit is not a number', () => {
limit: true,
},
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetGetOne request property "options.limit" should be a number.'
);
});
@ -254,7 +254,7 @@ test('skip is not a number', () => {
skip: true,
},
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetGetOne request property "options.skip" should be a number.'
);
});
@ -263,7 +263,7 @@ test('filter is not an object', () => {
const request = {
filter: true,
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetGetOne request property "filter" should be an object.'
);
});

View File

@ -182,12 +182,12 @@ test('valid request schema', () => {
name: 'New',
},
};
expect(validate({ schema, object: request })).toEqual({ valid: true });
expect(validate({ schema, data: request })).toEqual({ valid: true });
});
test('request properties is not an object', () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetUpdateMany request properties should be an object.'
);
});
@ -199,7 +199,7 @@ test('filter is not an object', () => {
name: 'New',
},
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetUpdateMany request property "filter" should be an object.'
);
});
@ -209,7 +209,7 @@ test('update is not an object', () => {
filter: { id: '1' },
update: 'update',
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetUpdateMany request property "update" should be an object.'
);
});
@ -220,7 +220,7 @@ test('filter is missing', () => {
name: 'New',
},
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetUpdateMany request should have required property "filter".'
);
});
@ -229,7 +229,7 @@ test('update is missing', () => {
const request = {
filter: { id: '1' },
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetUpdateMany request should have required property "update".'
);
});
@ -244,7 +244,7 @@ test('options.raw is not a boolean', () => {
raw: 'raw',
},
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetUpdateMany request property "options.raw" should be a boolean.'
);
});

View File

@ -251,12 +251,12 @@ test('valid request schema', () => {
name: 'New',
},
};
expect(validate({ schema, object: request })).toEqual({ valid: true });
expect(validate({ schema, data: request })).toEqual({ valid: true });
});
test('request properties is not an object', () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetUpdateOne request properties should be an object.'
);
});
@ -268,7 +268,7 @@ test('filter is not an object', () => {
name: 'New',
},
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetUpdateOne request property "filter" should be an object.'
);
});
@ -278,7 +278,7 @@ test('update is not an object', () => {
filter: { id: '1' },
update: 'update',
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetUpdateOne request property "update" should be an object.'
);
});
@ -289,7 +289,7 @@ test('filter is missing', () => {
name: 'New',
},
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetUpdateOne request should have required property "filter".'
);
});
@ -298,7 +298,7 @@ test('update is missing', () => {
const request = {
filter: { id: '1' },
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetUpdateOne request should have required property "update".'
);
});
@ -313,7 +313,7 @@ test('options.raw is not a boolean', () => {
raw: 'raw',
},
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'GoogleSheetUpdateOne request property "options.raw" should be a boolean.'
);
});

View File

@ -122,28 +122,28 @@ test('aggregation match dates', async () => {
test('request not an object', async () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBAggregation request properties should be an object.'
);
});
test('aggregation no pipeline', async () => {
const request = {};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBAggregation request should have required property "pipeline".'
);
});
test('aggregation pipeline not an array', async () => {
const request = { pipeline: 'pipeline' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBAggregation request property "pipeline" should be an array.'
);
});
test('aggregation options not an object', async () => {
const request = { pipeline, options: 'options' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBAggregation request property "options" should be an object.'
);
});

View File

@ -36,7 +36,7 @@ test('valid connection schema', () => {
databaseUri: 'databaseUri',
collection: 'collection',
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
});
test('valid connection schema, all properties', () => {
@ -47,12 +47,12 @@ test('valid connection schema, all properties', () => {
read: true,
write: true,
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
});
test('connection properties is not an object', () => {
const connection = 'connection';
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'MongoDBCollection connection properties should be an object.'
);
});
@ -61,7 +61,7 @@ test('databaseUri missing', () => {
const connection = {
collection: 'collection',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'MongoDBCollection connection should have required property "databaseUri".'
);
});
@ -71,7 +71,7 @@ test('databaseUri is not a string', () => {
databaseUri: true,
collection: 'collection',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'MongoDBCollection connection property "databaseUri" should be a string.'
);
});
@ -80,7 +80,7 @@ test('collection missing', () => {
const connection = {
databaseUri: 'databaseUri',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'MongoDBCollection connection should have required property "collection".'
);
});
@ -90,7 +90,7 @@ test('collection is not a string', () => {
databaseUri: 'databaseUri',
collection: true,
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'MongoDBCollection connection property "collection" should be a string.'
);
});
@ -101,7 +101,7 @@ test('databaseName is not a string', () => {
collection: 'collection',
databaseName: true,
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'MongoDBCollection connection property "databaseName" should be a string.'
);
});
@ -112,7 +112,7 @@ test('read is not a boolean', () => {
collection: 'collection',
read: 'read',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'MongoDBCollection connection property "read" should be a boolean.'
);
});
@ -123,7 +123,7 @@ test('write is not a boolean', () => {
collection: 'collection',
write: 'write',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'MongoDBCollection connection property "write" should be a boolean.'
);
});

View File

@ -124,28 +124,28 @@ test('checkWrite should be true', async () => {
test('request not an object', async () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBDeleteMany request properties should be an object.'
);
});
test('request no filter', async () => {
const request = {};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBDeleteMany request should have required property "filter".'
);
});
test('request filter not an object', async () => {
const request = { filter: 'filter' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBDeleteMany request property "filter" should be an object.'
);
});
test('request options not an object', async () => {
const request = { filter: { _id: 'test' }, options: 'options' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBDeleteMany request property "options" should be an object.'
);
});

View File

@ -84,28 +84,28 @@ test('deleteOne catch invalid options', async () => {
test('request not an object', async () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBDeleteOne request properties should be an object.'
);
});
test('request no filter', async () => {
const request = {};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBDeleteOne request should have required property "filter".'
);
});
test('request filter not an object', async () => {
const request = { filter: 'filter' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBDeleteOne request property "filter" should be an object.'
);
});
test('request options not an object', async () => {
const request = { filter: { _id: 'test' }, options: 'options' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBDeleteOne request property "options" should be an object.'
);
});

View File

@ -87,28 +87,28 @@ test('checkWrite should be false', async () => {
test('request not an object', async () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBFind request properties should be an object.'
);
});
test('request no query', async () => {
const request = {};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBFind request should have required property "query".'
);
});
test('request query not an object', async () => {
const request = { query: 'query' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBFind request property "query" should be an object.'
);
});
test('request options not an object', async () => {
const request = { query: { _id: 'test' }, options: 'options' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBFind request property "options" should be an object.'
);
});

View File

@ -108,28 +108,28 @@ test('checkWrite should be false', async () => {
test('request not an object', async () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBFindOne request properties should be an object.'
);
});
test('request no query', async () => {
const request = {};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBFindOne request should have required property "query".'
);
});
test('request query not an object', async () => {
const request = { query: 'query' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBFindOne request property "query" should be an object.'
);
});
test('request options not an object', async () => {
const request = { query: { _id: 'test' }, options: 'options' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBFindOne request property "options" should be an object.'
);
});

View File

@ -115,35 +115,35 @@ test('checkWrite should be true', async () => {
test('request not an object', async () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBInsertMany request properties should be an object.'
);
});
test('request no docs', async () => {
const request = {};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBInsertMany request should have required property "docs".'
);
});
test('request docs not an array', async () => {
const request = { docs: 'docs' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBInsertMany request property "docs" should be an array.'
);
});
test('request docs not an array of objects', async () => {
const request = { docs: [1, 2, 3] };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBInsertMany request property "docs" should be an array of documents to insert.'
);
});
test('request options not an object', async () => {
const request = { docs: [], options: 'options' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBInsertMany request property "options" should be an object.'
);
});

View File

@ -153,28 +153,28 @@ test('insertOne insert a date', async () => {
test('request not an object', async () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBInsertOne request properties should be an object.'
);
});
test('request no doc', async () => {
const request = {};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBInsertOne request should have required property "doc".'
);
});
test('request doc not an object', async () => {
const request = { doc: 'doc' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBInsertOne request property "doc" should be an object.'
);
});
test('request options not an object', async () => {
const request = { doc: {}, options: 'options' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBInsertOne request property "options" should be an object.'
);
});

View File

@ -200,42 +200,42 @@ test('checkWrite should be true', async () => {
test('request not an object', async () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBUpdateMany request properties should be an object.'
);
});
test('request no filter', async () => {
const request = { update: {} };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBUpdateMany request should have required property "filter".'
);
});
test('request no update', async () => {
const request = { filter: {} };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBUpdateMany request should have required property "update".'
);
});
test('request update not an object', async () => {
const request = { update: 'update', filter: {} };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBUpdateMany request property "update" should be an object.'
);
});
test('request filter not an object', async () => {
const request = { update: {}, filter: 'filter' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBUpdateMany request property "filter" should be an object.'
);
});
test('request options not an object', async () => {
const request = { update: {}, filter: {}, options: 'options' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBUpdateMany request property "options" should be an object.'
);
});

View File

@ -152,42 +152,42 @@ test('checkWrite should be true', async () => {
test('request not an object', async () => {
const request = 'request';
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBUpdateOne request properties should be an object.'
);
});
test('request no filter', async () => {
const request = { update: {} };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBUpdateOne request should have required property "filter".'
);
});
test('request no update', async () => {
const request = { filter: {} };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBUpdateOne request should have required property "update".'
);
});
test('request update not an object', async () => {
const request = { update: 'update', filter: {} };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBUpdateOne request property "update" should be an object.'
);
});
test('request filter not an object', async () => {
const request = { update: {}, filter: 'filter' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBUpdateOne request property "filter" should be an object.'
);
});
test('request options not an object', async () => {
const request = { update: {}, filter: {}, options: 'options' };
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'MongoDBUpdateOne request property "options" should be an object.'
);
});

View File

@ -28,12 +28,12 @@ test('valid connection schema', () => {
apiKey: 'API_KEY',
from: 'someone@example.com',
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
connection = {
apiKey: 'API_KEY',
from: 'Some One <someone@example.com>',
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
connection = {
apiKey: 'API_KEY',
from: {
@ -41,7 +41,7 @@ test('valid connection schema', () => {
email: 'someone@example.com',
},
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
});
test('valid connection schema, all email variations', () => {
@ -49,12 +49,12 @@ test('valid connection schema, all email variations', () => {
apiKey: 'API_KEY',
from: 'someone@example.com',
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
connection = {
apiKey: 'API_KEY',
from: 'Some One <someone@example.com>',
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
connection = {
apiKey: 'API_KEY',
from: {
@ -66,12 +66,12 @@ test('valid connection schema, all email variations', () => {
apiKey: 'API_KEY',
from: ['someone@example.com', 'someoneelse@example.com'],
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
connection = {
apiKey: 'API_KEY',
from: ['Some One <someone@example.com>', 'Some One Else <someoneelse@example.com>'],
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
connection = {
apiKey: 'API_KEY',
from: [
@ -85,7 +85,7 @@ test('valid connection schema, all email variations', () => {
},
],
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
});
test('valid connection schema, all properties', () => {
@ -102,14 +102,14 @@ test('valid connection schema, all properties', () => {
},
},
};
expect(validate({ schema, object: connection })).toEqual({ valid: true });
expect(validate({ schema, data: connection })).toEqual({ valid: true });
});
test('property apiKey is missing', () => {
const connection = {
from: 'someone@example.com',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'SendGridMail connection should have required property "apiKey".'
);
});
@ -119,7 +119,7 @@ test('property apiKey is not a string', () => {
apiKey: true,
from: 'someone@example.com',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'SendGridMail connection property "apiKey" should be a string.'
);
});
@ -128,7 +128,7 @@ test('property from is missing', () => {
const connection = {
apiKey: 'API_KEY',
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'SendGridMail connection should have required property "from".'
);
});
@ -138,7 +138,7 @@ test('property from is not a string', () => {
apiKey: 'API_KEY',
from: true,
};
expect(() => validate({ schema, object: connection })).toThrow(
expect(() => validate({ schema, data: connection })).toThrow(
'SendGridMail connection property "/from" should be a string.; SendGridMail connection property "/from" should be an email address, or a list of email addresses'
);
});

View File

@ -101,7 +101,7 @@ test('Error request with no to', async () => {
subject: 'A',
text: 'B',
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'SendGridMailSend request properties should be an object or a array describing emails to send.'
);
});
@ -112,7 +112,7 @@ test('Error request with to is not a email address', async () => {
text: 'B',
to: true,
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'SendGridMailSend request properties should be an object or a array describing emails to send.'
);
});
@ -123,7 +123,7 @@ test('Error request with subject is not a string', async () => {
text: 'B',
to: 'a@b.com',
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'SendGridMailSend request property "subject" should be a string.; SendGridMailSend request properties should be an object or a array describing emails to send.'
);
});
@ -133,7 +133,7 @@ test('Error request with text is not a string', async () => {
text: true,
to: 'a@b.com',
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'SendGridMailSend request properties should be an object or a array describing emails to send.'
);
});
@ -143,7 +143,7 @@ test('Error request with html is not a string', async () => {
html: true,
to: 'a@b.com',
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'SendGridMailSend request properties should be an object or a array describing emails to send.'
);
});
@ -153,7 +153,7 @@ test('Error request with dynamicTemplateData is not an object', async () => {
dynamicTemplateData: true,
to: 'a@b.com',
};
expect(() => validate({ schema, object: request })).toThrow(
expect(() => validate({ schema, data: request })).toThrow(
'SendGridMailSend request properties should be an object or a array describing emails to send.'
);
});

View File

@ -72,8 +72,8 @@ class RequestController {
});
try {
validate({ schema: connectionDefinition.schema, object: connectionProperties });
validate({ schema: requestDefinition.schema, object: requestProperties });
validate({ schema: connectionDefinition.schema, data: connectionProperties });
validate({ schema: requestDefinition.schema, data: requestProperties });
} catch (error) {
throw new ConfigurationError(error);
}