mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
cb76b738ce
refs https://github.com/TryGhost/Team/issues/1500 - newsletter schema columns were using incorrect syntax for `isIn` validations - adds schema test to make sure schema `isIn` validations are in correct format
21 lines
805 B
JavaScript
21 lines
805 B
JavaScript
const should = require('should');
|
|
const _ = require('lodash');
|
|
|
|
const schema = require('../../../../../core/server/data/schema/schema');
|
|
|
|
describe('schema validations', function () {
|
|
it('has correct isIn validation structure', async function () {
|
|
const tablesOnlyValidation = _.cloneDeep(schema);
|
|
|
|
_.each(tablesOnlyValidation, function (table) {
|
|
_.each(table, function (column) {
|
|
const columnIsInValidation = _.get(column, 'validations.isIn');
|
|
// Check column's isIn validation is in correct format
|
|
if (columnIsInValidation) {
|
|
should(columnIsInValidation).be.Array().with.length(1);
|
|
should(columnIsInValidation[0]).be.Array();
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|