Update Test & linting packages (major) (#10858)
no issue - Updated Test & linting packages - Updated use of hasOwnProperty - Using Object.prototype.hasOwnProperty instead (ref. eslint.org/docs/rules/no-prototype-builtins) - Removed already defined built-in global variable Intl - Applied `--fix` with lint command on `core/test` folder - The rules were broken because some of them were made stricter for `eslint: recommended` ruleset (ref. https://eslint.org/docs/user-guide/migrating-to-6.0.0#eslint-recommended-changes) - Removed redundant global variable declarations to pass linting
This commit is contained in:
parent
90bb40ed80
commit
db53ac0721
@ -31,7 +31,7 @@ exports.createAdapter = function (options) {
|
||||
}));
|
||||
}
|
||||
|
||||
if (cache.hasOwnProperty(activeAdapter)) {
|
||||
if (Object.prototype.hasOwnProperty.call(cache, activeAdapter)) {
|
||||
return cache[activeAdapter];
|
||||
}
|
||||
|
||||
|
@ -45,15 +45,15 @@ class Frame {
|
||||
apiConfig.options = apiConfig.options(this);
|
||||
}
|
||||
|
||||
if (this.original.hasOwnProperty('query')) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.original, 'query')) {
|
||||
Object.assign(this.options, _.pick(this.original.query, apiConfig.options));
|
||||
}
|
||||
|
||||
if (this.original.hasOwnProperty('params')) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.original, 'params')) {
|
||||
Object.assign(this.options, _.pick(this.original.params, apiConfig.options));
|
||||
}
|
||||
|
||||
if (this.original.hasOwnProperty('options')) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.original, 'options')) {
|
||||
Object.assign(this.options, _.pick(this.original.options, apiConfig.options));
|
||||
}
|
||||
}
|
||||
@ -68,15 +68,15 @@ class Frame {
|
||||
apiConfig.data = apiConfig.data(this);
|
||||
}
|
||||
|
||||
if (this.original.hasOwnProperty('query')) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.original, 'query')) {
|
||||
Object.assign(this.data, _.pick(this.original.query, apiConfig.data));
|
||||
}
|
||||
|
||||
if (this.original.hasOwnProperty('params')) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.original, 'params')) {
|
||||
Object.assign(this.data, _.pick(this.original.params, apiConfig.data));
|
||||
}
|
||||
|
||||
if (this.original.hasOwnProperty('options')) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.original, 'options')) {
|
||||
Object.assign(this.data, _.pick(this.original.options, apiConfig.data));
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ const STAGES = {
|
||||
const tasks = [];
|
||||
|
||||
// CASE: it's required to put the permission key to avoid security holes
|
||||
if (!apiImpl.hasOwnProperty('permissions')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(apiImpl, 'permissions')) {
|
||||
return Promise.reject(new common.errors.IncorrectUsageError());
|
||||
}
|
||||
|
||||
|
@ -121,24 +121,24 @@ const locationHeader = (req, result) => {
|
||||
statusQuery;
|
||||
|
||||
if (req.method === 'POST') {
|
||||
if (result.hasOwnProperty('posts')) {
|
||||
if (Object.prototype.hasOwnProperty.call(result, 'posts')) {
|
||||
newObject = result.posts[0];
|
||||
statusQuery = `/?status=${newObject.status}`;
|
||||
location = urlUtils.urlJoin(apiRoot, 'posts', newObject.id, statusQuery);
|
||||
} else if (result.hasOwnProperty('notifications')) {
|
||||
} else if (Object.prototype.hasOwnProperty.call(result, 'notifications')) {
|
||||
newObject = result.notifications[0];
|
||||
|
||||
// CASE: you add one notification, but it's a duplicate, the API will return {notifications: []}
|
||||
if (newObject) {
|
||||
location = urlUtils.urlJoin(apiRoot, 'notifications', newObject.id, '/');
|
||||
}
|
||||
} else if (result.hasOwnProperty('users')) {
|
||||
} else if (Object.prototype.hasOwnProperty.call(result, 'users')) {
|
||||
newObject = result.users[0];
|
||||
location = urlUtils.urlJoin(apiRoot, 'users', newObject.id, '/');
|
||||
} else if (result.hasOwnProperty('tags')) {
|
||||
} else if (Object.prototype.hasOwnProperty.call(result, 'tags')) {
|
||||
newObject = result.tags[0];
|
||||
location = urlUtils.urlJoin(apiRoot, 'tags', newObject.id, '/');
|
||||
} else if (result.hasOwnProperty('webhooks')) {
|
||||
} else if (Object.prototype.hasOwnProperty.call(result, 'webhooks')) {
|
||||
newObject = result.webhooks[0];
|
||||
location = urlUtils.urlJoin(apiRoot, 'webhooks', newObject.id, '/');
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ utils = {
|
||||
*
|
||||
* @deprecated: `author`, will be removed in Ghost 3.0
|
||||
*/
|
||||
if (object.posts[0].hasOwnProperty('author')) {
|
||||
if (Object.prototype.hasOwnProperty.call(object.posts[0], 'author')) {
|
||||
object.posts[0].author_id = object.posts[0].author;
|
||||
delete object.posts[0].author;
|
||||
}
|
||||
@ -352,7 +352,7 @@ utils = {
|
||||
*
|
||||
* @TODO: remove `id` restriction in Ghost 3.0
|
||||
*/
|
||||
if (object.posts[0].hasOwnProperty('authors')) {
|
||||
if (Object.prototype.hasOwnProperty.call(object.posts[0], 'authors')) {
|
||||
if (!_.isArray(object.posts[0].authors) ||
|
||||
(object.posts[0].authors.length && _.filter(object.posts[0].authors, 'id').length !== object.posts[0].authors.length)) {
|
||||
return Promise.reject(new common.errors.BadRequestError({
|
||||
@ -374,11 +374,11 @@ utils = {
|
||||
*/
|
||||
if (object.posts[0].authors && object.posts[0].authors.length) {
|
||||
_.each(object.posts[0].authors, (author, index) => {
|
||||
if (author.hasOwnProperty('roles')) {
|
||||
if (Object.prototype.hasOwnProperty.call(author, 'roles')) {
|
||||
delete object.posts[0].authors[index].roles;
|
||||
}
|
||||
|
||||
if (author.hasOwnProperty('permissions')) {
|
||||
if (Object.prototype.hasOwnProperty.call(author, 'permissions')) {
|
||||
delete object.posts[0].authors[index].permissions;
|
||||
}
|
||||
});
|
||||
@ -391,15 +391,15 @@ utils = {
|
||||
*
|
||||
* See @TODO on the fn description. This information lives in two places. Not nice.
|
||||
*/
|
||||
if (object.posts[0].hasOwnProperty('tags')) {
|
||||
if (Object.prototype.hasOwnProperty.call(object.posts[0], 'tags')) {
|
||||
if (_.isArray(object.posts[0].tags) && object.posts[0].tags.length) {
|
||||
_.each(object.posts[0].tags, (tag, index) => {
|
||||
if (tag.hasOwnProperty('parent')) {
|
||||
if (Object.prototype.hasOwnProperty.call(tag, 'parent')) {
|
||||
object.posts[0].tags[index].parent_id = tag.parent;
|
||||
delete object.posts[0].tags[index].parent;
|
||||
}
|
||||
|
||||
if (tag.hasOwnProperty('posts')) {
|
||||
if (Object.prototype.hasOwnProperty.call(tag, 'posts')) {
|
||||
delete object.posts[0].tags[index].posts;
|
||||
}
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
module.exports.forPost = (frame, model, attrs) => {
|
||||
const _ = require('lodash');
|
||||
|
||||
if (!frame.options.hasOwnProperty('columns') ||
|
||||
if (!Object.prototype.hasOwnProperty.call(frame.options, 'columns') ||
|
||||
(frame.options.columns.includes('excerpt') && frame.options.formats && frame.options.formats.includes('plaintext'))) {
|
||||
if (_.isEmpty(attrs.custom_excerpt)) {
|
||||
const plaintext = model.get('plaintext');
|
||||
|
@ -11,7 +11,7 @@ function configure(dbConfig) {
|
||||
var client = dbConfig.client;
|
||||
|
||||
if (client === 'sqlite3') {
|
||||
dbConfig.useNullAsDefault = dbConfig.hasOwnProperty('useNullAsDefault') ? dbConfig.useNullAsDefault : true;
|
||||
dbConfig.useNullAsDefault = Object.prototype.hasOwnProperty.call(dbConfig, 'useNullAsDefault') ? dbConfig.useNullAsDefault : true;
|
||||
}
|
||||
|
||||
if (client === 'mysql') {
|
||||
|
@ -183,7 +183,7 @@ class Base {
|
||||
let userReferenceProblems = {};
|
||||
|
||||
const handleObject = (obj, key) => {
|
||||
if (!obj.hasOwnProperty(key)) {
|
||||
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ DataImporter = {
|
||||
}
|
||||
};
|
||||
|
||||
if (!importOptions.hasOwnProperty('returnImportedData')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(importOptions, 'returnImportedData')) {
|
||||
importOptions.returnImportedData = false;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class UsersImporter extends BaseImporter {
|
||||
|
||||
// NOTE: sort out duplicated roles based on incremental id
|
||||
_.each(this.requiredFromFile.roles_users, (attachedRole) => {
|
||||
if (lookup.hasOwnProperty(attachedRole.user_id)) {
|
||||
if (Object.prototype.hasOwnProperty.call(lookup, attachedRole.user_id)) {
|
||||
if (lookup[attachedRole.user_id].id < attachedRole.id) {
|
||||
lookup[attachedRole.user_id] = attachedRole;
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ _.extend(ImportManager.prototype, {
|
||||
baseDir = self.getBaseDirectory(zipDirectory);
|
||||
|
||||
_.each(self.handlers, function (handler) {
|
||||
if (importData.hasOwnProperty(handler.type)) {
|
||||
if (Object.prototype.hasOwnProperty.call(importData, handler.type)) {
|
||||
// This limitation is here to reduce the complexity of the importer for now
|
||||
return Promise.reject(new common.errors.UnsupportedMediaTypeError({
|
||||
message: common.i18n.t('errors.data.importer.index.zipContainsMultipleDataFormats')
|
||||
@ -326,7 +326,7 @@ _.extend(ImportManager.prototype, {
|
||||
importOptions = importOptions || {};
|
||||
var ops = [];
|
||||
_.each(this.importers, function (importer) {
|
||||
if (importData.hasOwnProperty(importer.type)) {
|
||||
if (Object.prototype.hasOwnProperty.call(importData, importer.type)) {
|
||||
ops.push(function () {
|
||||
return importer.doImport(importData[importer.type], importOptions);
|
||||
});
|
||||
|
@ -1,21 +1,21 @@
|
||||
function isPost(jsonData) {
|
||||
return jsonData.hasOwnProperty('html') &&
|
||||
jsonData.hasOwnProperty('title') && jsonData.hasOwnProperty('slug');
|
||||
return Object.prototype.hasOwnProperty.call(jsonData, 'html') &&
|
||||
Object.prototype.hasOwnProperty.call(jsonData, 'title') && Object.prototype.hasOwnProperty.call(jsonData, 'slug');
|
||||
}
|
||||
|
||||
function isTag(jsonData) {
|
||||
return jsonData.hasOwnProperty('name') && jsonData.hasOwnProperty('slug') &&
|
||||
jsonData.hasOwnProperty('description') && jsonData.hasOwnProperty('feature_image');
|
||||
return Object.prototype.hasOwnProperty.call(jsonData, 'name') && Object.prototype.hasOwnProperty.call(jsonData, 'slug') &&
|
||||
Object.prototype.hasOwnProperty.call(jsonData, 'description') && Object.prototype.hasOwnProperty.call(jsonData, 'feature_image');
|
||||
}
|
||||
|
||||
function isUser(jsonData) {
|
||||
return jsonData.hasOwnProperty('bio') && jsonData.hasOwnProperty('website') &&
|
||||
jsonData.hasOwnProperty('profile_image') && jsonData.hasOwnProperty('location');
|
||||
return Object.prototype.hasOwnProperty.call(jsonData, 'bio') && Object.prototype.hasOwnProperty.call(jsonData, 'website') &&
|
||||
Object.prototype.hasOwnProperty.call(jsonData, 'profile_image') && Object.prototype.hasOwnProperty.call(jsonData, 'location');
|
||||
}
|
||||
|
||||
function isNav(jsonData) {
|
||||
return jsonData.hasOwnProperty('label') && jsonData.hasOwnProperty('url') &&
|
||||
jsonData.hasOwnProperty('slug') && jsonData.hasOwnProperty('current');
|
||||
return Object.prototype.hasOwnProperty.call(jsonData, 'label') && Object.prototype.hasOwnProperty.call(jsonData, 'url') &&
|
||||
Object.prototype.hasOwnProperty.call(jsonData, 'slug') && Object.prototype.hasOwnProperty.call(jsonData, 'current');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@ -10,10 +10,10 @@ function addTableColumn(tableName, table, columnName) {
|
||||
columnSpec = schema[tableName][columnName];
|
||||
|
||||
// creation distinguishes between text with fieldtype, string with maxlength and all others
|
||||
if (columnSpec.type === 'text' && columnSpec.hasOwnProperty('fieldtype')) {
|
||||
if (columnSpec.type === 'text' && Object.prototype.hasOwnProperty.call(columnSpec, 'fieldtype')) {
|
||||
column = table[columnSpec.type](columnName, columnSpec.fieldtype);
|
||||
} else if (columnSpec.type === 'string') {
|
||||
if (columnSpec.hasOwnProperty('maxlength')) {
|
||||
if (Object.prototype.hasOwnProperty.call(columnSpec, 'maxlength')) {
|
||||
column = table[columnSpec.type](columnName, columnSpec.maxlength);
|
||||
} else {
|
||||
column = table[columnSpec.type](columnName, 191);
|
||||
@ -22,28 +22,28 @@ function addTableColumn(tableName, table, columnName) {
|
||||
column = table[columnSpec.type](columnName);
|
||||
}
|
||||
|
||||
if (columnSpec.hasOwnProperty('nullable') && columnSpec.nullable === true) {
|
||||
if (Object.prototype.hasOwnProperty.call(columnSpec, 'nullable') && columnSpec.nullable === true) {
|
||||
column.nullable();
|
||||
} else {
|
||||
column.nullable(false);
|
||||
}
|
||||
if (columnSpec.hasOwnProperty('primary') && columnSpec.primary === true) {
|
||||
if (Object.prototype.hasOwnProperty.call(columnSpec, 'primary') && columnSpec.primary === true) {
|
||||
column.primary();
|
||||
}
|
||||
if (columnSpec.hasOwnProperty('unique') && columnSpec.unique) {
|
||||
if (Object.prototype.hasOwnProperty.call(columnSpec, 'unique') && columnSpec.unique) {
|
||||
column.unique();
|
||||
}
|
||||
if (columnSpec.hasOwnProperty('unsigned') && columnSpec.unsigned) {
|
||||
if (Object.prototype.hasOwnProperty.call(columnSpec, 'unsigned') && columnSpec.unsigned) {
|
||||
column.unsigned();
|
||||
}
|
||||
if (columnSpec.hasOwnProperty('references')) {
|
||||
if (Object.prototype.hasOwnProperty.call(columnSpec, 'references')) {
|
||||
// check if table exists?
|
||||
column.references(columnSpec.references);
|
||||
}
|
||||
if (columnSpec.hasOwnProperty('defaultTo')) {
|
||||
if (Object.prototype.hasOwnProperty.call(columnSpec, 'defaultTo')) {
|
||||
column.defaultTo(columnSpec.defaultTo);
|
||||
}
|
||||
if (columnSpec.hasOwnProperty('index') && columnSpec.index === true) {
|
||||
if (Object.prototype.hasOwnProperty.call(columnSpec, 'index') && columnSpec.index === true) {
|
||||
column.index();
|
||||
}
|
||||
}
|
||||
|
@ -190,9 +190,9 @@ validateSchema = function validateSchema(tableName, model, options) {
|
||||
}
|
||||
|
||||
// check nullable
|
||||
if (schema[tableName][columnKey].hasOwnProperty('nullable') &&
|
||||
if (Object.prototype.hasOwnProperty.call(schema[tableName][columnKey], 'nullable') &&
|
||||
schema[tableName][columnKey].nullable !== true &&
|
||||
!schema[tableName][columnKey].hasOwnProperty('defaultTo')
|
||||
!Object.prototype.hasOwnProperty.call(schema[tableName][columnKey], 'defaultTo')
|
||||
) {
|
||||
if (validator.empty(strVal)) {
|
||||
message = common.i18n.t('notices.data.validation.index.valueCannotBeBlank', {
|
||||
@ -207,7 +207,7 @@ validateSchema = function validateSchema(tableName, model, options) {
|
||||
}
|
||||
|
||||
// validate boolean columns
|
||||
if (schema[tableName][columnKey].hasOwnProperty('type')
|
||||
if (Object.prototype.hasOwnProperty.call(schema[tableName][columnKey], 'type')
|
||||
&& schema[tableName][columnKey].type === 'bool') {
|
||||
if (!(validator.isBoolean(strVal) || validator.empty(strVal))) {
|
||||
message = common.i18n.t('notices.data.validation.index.valueMustBeBoolean', {
|
||||
@ -229,7 +229,7 @@ validateSchema = function validateSchema(tableName, model, options) {
|
||||
// TODO: check if mandatory values should be enforced
|
||||
if (model.get(columnKey) !== null && model.get(columnKey) !== undefined) {
|
||||
// check length
|
||||
if (schema[tableName][columnKey].hasOwnProperty('maxlength')) {
|
||||
if (Object.prototype.hasOwnProperty.call(schema[tableName][columnKey], 'maxlength')) {
|
||||
if (!validator.isLength(strVal, 0, schema[tableName][columnKey].maxlength)) {
|
||||
message = common.i18n.t('notices.data.validation.index.valueExceedsMaxLength',
|
||||
{
|
||||
@ -245,12 +245,12 @@ validateSchema = function validateSchema(tableName, model, options) {
|
||||
}
|
||||
|
||||
// check validations objects
|
||||
if (schema[tableName][columnKey].hasOwnProperty('validations')) {
|
||||
if (Object.prototype.hasOwnProperty.call(schema[tableName][columnKey], 'validations')) {
|
||||
validationErrors = validationErrors.concat(validate(strVal, columnKey, schema[tableName][columnKey].validations, tableName));
|
||||
}
|
||||
|
||||
// check type
|
||||
if (schema[tableName][columnKey].hasOwnProperty('type')) {
|
||||
if (Object.prototype.hasOwnProperty.call(schema[tableName][columnKey], 'type')) {
|
||||
if (schema[tableName][columnKey].type === 'integer' && !validator.isInt(strVal)) {
|
||||
message = common.i18n.t('notices.data.validation.index.valueIsNotInteger', {
|
||||
tableName: tableName,
|
||||
|
@ -45,7 +45,7 @@ GhostServer.prototype.start = function (externalApp) {
|
||||
};
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (config.get('server').hasOwnProperty('socket')) {
|
||||
if (Object.prototype.hasOwnProperty.call(config.get('server'), 'socket')) {
|
||||
socketConfig = config.get('server').socket;
|
||||
|
||||
if (_.isString(socketConfig)) {
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* global Intl */
|
||||
|
||||
const supportedLocales = ['en'],
|
||||
chalk = require('chalk'),
|
||||
fs = require('fs-extra'),
|
||||
|
@ -312,25 +312,25 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
|
||||
* Exceptions: internal context or importing
|
||||
*/
|
||||
onCreating: function onCreating(model, attr, options) {
|
||||
if (schema.tables[this.tableName].hasOwnProperty('created_by')) {
|
||||
if (Object.prototype.hasOwnProperty.call(schema.tables[this.tableName], 'created_by')) {
|
||||
if (!options.importing || (options.importing && !this.get('created_by'))) {
|
||||
this.set('created_by', String(this.contextUser(options)));
|
||||
}
|
||||
}
|
||||
|
||||
if (schema.tables[this.tableName].hasOwnProperty('updated_by')) {
|
||||
if (Object.prototype.hasOwnProperty.call(schema.tables[this.tableName], 'updated_by')) {
|
||||
if (!options.importing) {
|
||||
this.set('updated_by', String(this.contextUser(options)));
|
||||
}
|
||||
}
|
||||
|
||||
if (schema.tables[this.tableName].hasOwnProperty('created_at')) {
|
||||
if (Object.prototype.hasOwnProperty.call(schema.tables[this.tableName], 'created_at')) {
|
||||
if (!model.get('created_at')) {
|
||||
model.set('created_at', new Date());
|
||||
}
|
||||
}
|
||||
|
||||
if (schema.tables[this.tableName].hasOwnProperty('updated_at')) {
|
||||
if (Object.prototype.hasOwnProperty.call(schema.tables[this.tableName], 'updated_at')) {
|
||||
if (!model.get('updated_at')) {
|
||||
model.set('updated_at', new Date());
|
||||
}
|
||||
@ -378,20 +378,20 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
|
||||
model.changed = _.omit(model.changed, this.relationships);
|
||||
}
|
||||
|
||||
if (schema.tables[this.tableName].hasOwnProperty('updated_by')) {
|
||||
if (Object.prototype.hasOwnProperty.call(schema.tables[this.tableName], 'updated_by')) {
|
||||
if (!options.importing && !options.migrating) {
|
||||
this.set('updated_by', String(this.contextUser(options)));
|
||||
}
|
||||
}
|
||||
|
||||
if (options && options.context && !options.context.internal && !options.importing) {
|
||||
if (schema.tables[this.tableName].hasOwnProperty('created_at')) {
|
||||
if (Object.prototype.hasOwnProperty.call(schema.tables[this.tableName], 'created_at')) {
|
||||
if (model.hasDateChanged('created_at', {beforeWrite: true})) {
|
||||
model.set('created_at', this.previous('created_at'));
|
||||
}
|
||||
}
|
||||
|
||||
if (schema.tables[this.tableName].hasOwnProperty('created_by')) {
|
||||
if (Object.prototype.hasOwnProperty.call(schema.tables[this.tableName], 'created_by')) {
|
||||
if (model.hasChanged('created_by')) {
|
||||
model.set('created_by', String(this.previous('created_by')));
|
||||
}
|
||||
@ -399,7 +399,7 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
|
||||
}
|
||||
|
||||
// CASE: do not allow setting only the `updated_at` field, exception: importing
|
||||
if (schema.tables[this.tableName].hasOwnProperty('updated_at') && !options.importing) {
|
||||
if (Object.prototype.hasOwnProperty.call(schema.tables[this.tableName], 'updated_at') && !options.importing) {
|
||||
if (options.migrating) {
|
||||
model.set('updated_at', model.previous('updated_at'));
|
||||
} else if (Object.keys(model.changed).length === 1 && model.changed.updated_at) {
|
||||
@ -445,7 +445,7 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
|
||||
|
||||
_.each(attrs, function each(value, key) {
|
||||
if (value !== null
|
||||
&& schema.tables[self.tableName].hasOwnProperty(key)
|
||||
&& Object.prototype.hasOwnProperty.call(schema.tables[self.tableName], key)
|
||||
&& schema.tables[self.tableName][key].type === 'dateTime') {
|
||||
attrs[key] = moment(value).format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
@ -467,7 +467,7 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
|
||||
|
||||
_.each(attrs, function each(value, key) {
|
||||
if (value !== null
|
||||
&& schema.tables[self.tableName].hasOwnProperty(key)
|
||||
&& Object.prototype.hasOwnProperty.call(schema.tables[self.tableName], key)
|
||||
&& schema.tables[self.tableName][key].type === 'dateTime') {
|
||||
dateMoment = moment(value);
|
||||
|
||||
@ -488,7 +488,7 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
|
||||
fixBools: function fixBools(attrs) {
|
||||
var self = this;
|
||||
_.each(attrs, function each(value, key) {
|
||||
if (schema.tables[self.tableName].hasOwnProperty(key)
|
||||
if (Object.prototype.hasOwnProperty.call(schema.tables[self.tableName], key)
|
||||
&& schema.tables[self.tableName][key].type === 'bool') {
|
||||
attrs[key] = value ? true : false;
|
||||
}
|
||||
@ -605,7 +605,7 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
|
||||
|
||||
if (this.relationships) {
|
||||
this.relationships.forEach((relation) => {
|
||||
if (this._previousRelations && this._previousRelations.hasOwnProperty(relation)) {
|
||||
if (this._previousRelations && Object.prototype.hasOwnProperty.call(this._previousRelations, relation)) {
|
||||
clonedModel.related(relation).models = this._previousRelations[relation].models;
|
||||
}
|
||||
});
|
||||
@ -737,7 +737,7 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
|
||||
|
||||
_.each(data, (value, property) => {
|
||||
if (value !== null
|
||||
&& schema.tables[tableName].hasOwnProperty(property)
|
||||
&& Object.prototype.hasOwnProperty.call(schema.tables[tableName], property)
|
||||
&& schema.tables[tableName][property].type === 'dateTime'
|
||||
&& typeof value === 'string'
|
||||
) {
|
||||
@ -758,7 +758,7 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
|
||||
_.each(data[property], (relation, indexInArr) => {
|
||||
_.each(relation, (value, relationProperty) => {
|
||||
if (value !== null
|
||||
&& schema.tables[this.prototype.relationshipBelongsTo[property]].hasOwnProperty(relationProperty)
|
||||
&& Object.prototype.hasOwnProperty.call(schema.tables[this.prototype.relationshipBelongsTo[property]], relationProperty)
|
||||
&& schema.tables[this.prototype.relationshipBelongsTo[property]][relationProperty].type === 'dateTime'
|
||||
&& typeof value === 'string'
|
||||
) {
|
||||
@ -792,7 +792,7 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
|
||||
unfilteredOptions = unfilteredOptions || {};
|
||||
filterConfig = filterConfig || {};
|
||||
|
||||
if (unfilteredOptions.hasOwnProperty('include')) {
|
||||
if (Object.prototype.hasOwnProperty.call(unfilteredOptions, 'include')) {
|
||||
throw new common.errors.IncorrectUsageError({
|
||||
message: 'The model layer expects using `withRelated`.'
|
||||
});
|
||||
|
@ -137,7 +137,7 @@ common.events.on('settings.notifications.edited', function (settingModel) {
|
||||
|
||||
allNotifications = allNotifications.filter(function (notification) {
|
||||
// Do not delete the release notification
|
||||
if (notification.hasOwnProperty('custom') && !notification.custom) {
|
||||
if (Object.prototype.hasOwnProperty.call(notification, 'custom') && !notification.custom) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -181,11 +181,11 @@ Settings = ghostBookshelf.Model.extend({
|
||||
return setting.save(item, options);
|
||||
} else {
|
||||
// If we have a value, set it.
|
||||
if (item.hasOwnProperty('value')) {
|
||||
if (Object.prototype.hasOwnProperty.call(item, 'value')) {
|
||||
setting.set('value', item.value);
|
||||
}
|
||||
// Internal context can overwrite type (for fixture migrations)
|
||||
if (options.context && options.context.internal && item.hasOwnProperty('type')) {
|
||||
if (options.context && options.context.internal && Object.prototype.hasOwnProperty.call(item, 'type')) {
|
||||
setting.set('type', item.type);
|
||||
}
|
||||
|
||||
|
@ -132,6 +132,6 @@ module.exports.getBearerAutorizationToken = function (req) {
|
||||
};
|
||||
|
||||
module.exports.hasGrantType = function hasGrantType(req, type) {
|
||||
return req.body && req.body.hasOwnProperty('grant_type') && req.body.grant_type === type
|
||||
|| req.query && req.query.hasOwnProperty('grant_type') && req.query.grant_type === type;
|
||||
return req.body && Object.prototype.hasOwnProperty.call(req.body, 'grant_type') && req.body.grant_type === type
|
||||
|| req.query && Object.prototype.hasOwnProperty.call(req.query, 'grant_type') && req.query.grant_type === type;
|
||||
};
|
||||
|
@ -72,7 +72,7 @@ function createCustomNotification(notification) {
|
||||
status: message.status || 'alert',
|
||||
type: message.type || 'info',
|
||||
id: message.id,
|
||||
dismissible: message.hasOwnProperty('dismissible') ? message.dismissible : true,
|
||||
dismissible: Object.prototype.hasOwnProperty.call(message, 'dismissible') ? message.dismissible : true,
|
||||
top: !!message.top,
|
||||
message: message.content
|
||||
};
|
||||
@ -240,7 +240,7 @@ function updateCheckResponse(response) {
|
||||
*/
|
||||
if (_.isArray(response)) {
|
||||
notifications = response;
|
||||
} else if ((response.hasOwnProperty('notifications') && _.isArray(response.notifications))) {
|
||||
} else if ((Object.prototype.hasOwnProperty.call(response, 'notifications') && _.isArray(response.notifications))) {
|
||||
notifications = response.notifications;
|
||||
} else {
|
||||
// CASE: default right now
|
||||
|
@ -17,7 +17,7 @@ const cacheControl = (options) => {
|
||||
|
||||
let output;
|
||||
|
||||
if (isString(options) && profiles.hasOwnProperty(options)) {
|
||||
if (isString(options) && Object.prototype.hasOwnProperty.call(profiles, options)) {
|
||||
output = profiles[options];
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ module.exports = function setupSiteApp(options = {}) {
|
||||
config.get('apps:internal').forEach((appName) => {
|
||||
const app = require(path.join(config.get('paths').internalAppPath, appName));
|
||||
|
||||
if (app.hasOwnProperty('setupMiddleware')) {
|
||||
if (Object.prototype.hasOwnProperty.call(app, 'setupMiddleware')) {
|
||||
app.setupMiddleware(siteApp);
|
||||
}
|
||||
});
|
||||
|
@ -70,7 +70,7 @@ describe('Integrations API', function () {
|
||||
name: 'Integratatron4000',
|
||||
webhooks: [{
|
||||
event: 'something',
|
||||
target_url: 'http://example.com',
|
||||
target_url: 'http://example.com'
|
||||
}]
|
||||
}]
|
||||
})
|
||||
@ -177,7 +177,7 @@ describe('Integrations API', function () {
|
||||
should.equal(body.meta.pagination.next, null);
|
||||
should.equal(body.meta.pagination.prev, null);
|
||||
|
||||
body.integrations.forEach(integration => {
|
||||
body.integrations.forEach((integration) => {
|
||||
should.exist(integration.api_keys);
|
||||
});
|
||||
|
||||
@ -241,7 +241,7 @@ describe('Integrations API', function () {
|
||||
.set('Origin', config.get('url'))
|
||||
.send({
|
||||
integrations: [{
|
||||
name: 'Webhook-less Integration',
|
||||
name: 'Webhook-less Integration'
|
||||
}]
|
||||
})
|
||||
.expect(201)
|
||||
|
@ -161,23 +161,23 @@ describe('Settings API', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('Can download routes.yaml', ()=> {
|
||||
it('Can download routes.yaml', () => {
|
||||
return request.get(localUtils.API.getApiQuery('settings/routes/yaml/'))
|
||||
.set('Origin', config.get('url'))
|
||||
.set('Accept', 'application/yaml')
|
||||
.expect(200)
|
||||
.then((res)=> {
|
||||
.then((res) => {
|
||||
res.headers['content-disposition'].should.eql('Attachment; filename="routes.yaml"');
|
||||
res.headers['content-type'].should.eql('application/yaml; charset=utf-8');
|
||||
res.headers['content-length'].should.eql('138');
|
||||
});
|
||||
});
|
||||
|
||||
it('Can upload routes.yaml', ()=> {
|
||||
it('Can upload routes.yaml', () => {
|
||||
const newRoutesYamlPath = `${os.tmpdir()}/routes.yaml`;
|
||||
|
||||
return fs.writeFile(newRoutesYamlPath, 'routes:\ncollections:\ntaxonomies:\n')
|
||||
.then(()=> {
|
||||
.then(() => {
|
||||
return request
|
||||
.post(localUtils.API.getApiQuery('settings/routes/yaml/'))
|
||||
.set('Origin', config.get('url'))
|
||||
@ -185,10 +185,10 @@ describe('Settings API', function () {
|
||||
.expect('Content-Type', /application\/json/)
|
||||
.expect(200);
|
||||
})
|
||||
.then((res)=> {
|
||||
.then((res) => {
|
||||
res.headers['x-cache-invalidate'].should.eql('/*');
|
||||
})
|
||||
.finally(()=> {
|
||||
.finally(() => {
|
||||
return ghostServer.stop();
|
||||
});
|
||||
});
|
||||
|
@ -61,7 +61,7 @@ describe('Authors Content API', function () {
|
||||
// Public api returns all authors, but no status! Locked/Inactive authors can still have written articles.
|
||||
models.Author.findPage(Object.assign({status: 'all'}, testUtils.context.internal))
|
||||
.then((response) => {
|
||||
_.map(response.data, (model) => model.toJSON()).length.should.eql(3);
|
||||
_.map(response.data, model => model.toJSON()).length.should.eql(3);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@ -93,7 +93,7 @@ describe('Authors Content API', function () {
|
||||
|
||||
const ids = jsonResponse.authors
|
||||
.filter(author => (author.slug !== 'ghost'))
|
||||
.map(user=> user.id);
|
||||
.map(user => user.id);
|
||||
|
||||
ids.should.eql([
|
||||
testUtils.DataGenerator.Content.users[3].id,
|
||||
|
@ -114,7 +114,7 @@ describe('Posts Content API', function () {
|
||||
testUtils.DataGenerator.Content.posts[4].id,
|
||||
testUtils.DataGenerator.Content.posts[2].id,
|
||||
testUtils.DataGenerator.Content.posts[1].id,
|
||||
testUtils.DataGenerator.Content.posts[0].id,
|
||||
testUtils.DataGenerator.Content.posts[0].id
|
||||
]);
|
||||
|
||||
// Each post must either be featured or have the tag 'kitchen-sink'
|
||||
@ -170,8 +170,13 @@ describe('Posts Content API', function () {
|
||||
});
|
||||
|
||||
primaryAuthors.should.matchAny(/joe-bloggs|ghost'/);
|
||||
_.filter(primaryAuthors, (value) => {return value === 'ghost';}).length.should.eql(7);
|
||||
_.filter(primaryAuthors, (value) => {return value === 'joe-bloggs';}).length.should.eql(4);
|
||||
_.filter(primaryAuthors, (value) => {
|
||||
return value === 'ghost';
|
||||
}).length.should.eql(7);
|
||||
|
||||
_.filter(primaryAuthors, (value) => {
|
||||
return value === 'joe-bloggs';
|
||||
}).length.should.eql(4);
|
||||
|
||||
done();
|
||||
});
|
||||
|
@ -59,8 +59,8 @@ describe('Settings Content API', function () {
|
||||
return;
|
||||
}
|
||||
|
||||
let defaultKey = _.findKey(publicSettings, (v) => v === key);
|
||||
let defaultValue = _.find(defaultSettings, (setting) => setting.key === defaultKey).defaultValue;
|
||||
let defaultKey = _.findKey(publicSettings, v => v === key);
|
||||
let defaultValue = _.find(defaultSettings, setting => setting.key === defaultKey).defaultValue;
|
||||
|
||||
// Convert empty strings to null
|
||||
defaultValue = defaultValue || null;
|
||||
|
@ -144,7 +144,7 @@ describe('Notifications API', function () {
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
const jsonResponse = res.body;
|
||||
|
||||
jsonResponse.notifications.should.be.an.Array().with.lengthOf(4);
|
||||
@ -210,7 +210,7 @@ describe('Notifications API', function () {
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(404)
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
res.body.errors[0].message.should.equal('Notification does not exist.');
|
||||
});
|
||||
});
|
||||
|
@ -116,7 +116,7 @@ describe('Public API', function () {
|
||||
testUtils.DataGenerator.Content.posts[4].id,
|
||||
testUtils.DataGenerator.Content.posts[2].id,
|
||||
testUtils.DataGenerator.Content.posts[1].id,
|
||||
testUtils.DataGenerator.Content.posts[0].id,
|
||||
testUtils.DataGenerator.Content.posts[0].id
|
||||
]);
|
||||
|
||||
// API does not return drafts
|
||||
@ -755,7 +755,7 @@ describe('Public API', function () {
|
||||
// Public api returns all users, but no status! Locked/Inactive users can still have written articles.
|
||||
models.User.findPage(Object.assign({status: 'all'}, testUtils.context.internal))
|
||||
.then((response) => {
|
||||
_.map(response.data, (model) => model.toJSON()).length.should.eql(7);
|
||||
_.map(response.data, model => model.toJSON()).length.should.eql(7);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@ -903,7 +903,7 @@ describe('Public API', function () {
|
||||
const ids = jsonResponse.users
|
||||
.filter(user => (user.slug !== 'ghost'))
|
||||
.filter(user => (user.slug !== 'inactive'))
|
||||
.map(user=> user.id);
|
||||
.map(user => user.id);
|
||||
|
||||
ids.should.eql([
|
||||
testUtils.DataGenerator.Content.users[1].id,
|
||||
|
@ -251,23 +251,23 @@ describe('Settings API', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('can download routes.yaml', ()=> {
|
||||
it('can download routes.yaml', () => {
|
||||
return request.get(localUtils.API.getApiQuery('settings/routes/yaml/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
.set('Accept', 'application/yaml')
|
||||
.expect(200)
|
||||
.then((res)=> {
|
||||
.then((res) => {
|
||||
res.headers['content-disposition'].should.eql('Attachment; filename="routes.yaml"');
|
||||
res.headers['content-type'].should.eql('application/yaml; charset=utf-8');
|
||||
res.headers['content-length'].should.eql('138');
|
||||
});
|
||||
});
|
||||
|
||||
it('can upload routes.yaml', ()=> {
|
||||
it('can upload routes.yaml', () => {
|
||||
const newRoutesYamlPath = `${os.tmpdir()}/routes.yaml`;
|
||||
|
||||
return fs.writeFile(newRoutesYamlPath, 'routes:\ncollections:\ntaxonomies:\n')
|
||||
.then(()=> {
|
||||
.then(() => {
|
||||
return request
|
||||
.post(localUtils.API.getApiQuery('settings/routes/yaml/'))
|
||||
.set('Authorization', 'Bearer ' + accesstoken)
|
||||
@ -276,10 +276,10 @@ describe('Settings API', function () {
|
||||
.expect('Content-Type', /application\/json/)
|
||||
.expect(200);
|
||||
})
|
||||
.then((res)=> {
|
||||
.then((res) => {
|
||||
res.headers['x-cache-invalidate'].should.eql('/*');
|
||||
})
|
||||
.finally(()=> {
|
||||
.finally(() => {
|
||||
return ghostServer.stop();
|
||||
});
|
||||
});
|
||||
|
@ -147,7 +147,7 @@ describe('DB API', () => {
|
||||
return request.post(localUtils.API.getApiQuery(`db/backup${schedulerQuery}`))
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(403)
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
should.exist(res.body.errors);
|
||||
res.body.errors[0].type.should.eql('NoPermissionError');
|
||||
fsStub.called.should.eql(false);
|
||||
@ -161,7 +161,7 @@ describe('DB API', () => {
|
||||
.set('Origin', config.get('url'))
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(401)
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
should.exist(res.body.errors);
|
||||
res.body.errors[0].type.should.eql('UnauthorizedError');
|
||||
fsStub.called.should.eql(false);
|
||||
|
@ -130,7 +130,7 @@ describe('Posts API', function () {
|
||||
.set('Origin', config.get('url'))
|
||||
.send({
|
||||
posts: [{
|
||||
title: '',
|
||||
title: ''
|
||||
}]
|
||||
})
|
||||
.expect('Content-Type', /json/)
|
||||
|
@ -150,7 +150,7 @@ describe('Posts', function () {
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.then((res)=> {
|
||||
.then((res) => {
|
||||
localUtils.API.checkResponse(res.body.posts[0], 'post', null, null, ['id', 'title', 'slug']);
|
||||
});
|
||||
});
|
||||
|
@ -32,7 +32,7 @@ describe('Tags', function () {
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.then((res)=> {
|
||||
.then((res) => {
|
||||
localUtils.API.checkResponse(res.body.tags[0], 'tag', null, null, ['id', 'name', 'slug']);
|
||||
});
|
||||
});
|
||||
|
@ -285,7 +285,7 @@ describe('Integration: Importer', function () {
|
||||
|
||||
exportData.data.posts_tags = [
|
||||
testUtils.DataGenerator.forKnex.createPostsTags(exportData.data.posts[0].id, exportData.data.tags[0].id),
|
||||
testUtils.DataGenerator.forKnex.createPostsTags(exportData.data.posts[0].id, exportData.data.tags[1].id),
|
||||
testUtils.DataGenerator.forKnex.createPostsTags(exportData.data.posts[0].id, exportData.data.tags[1].id)
|
||||
];
|
||||
|
||||
return dataImporter.doImport(exportData, importOptions)
|
||||
@ -319,7 +319,7 @@ describe('Integration: Importer', function () {
|
||||
|
||||
exportData.data.posts_tags = [
|
||||
testUtils.DataGenerator.forKnex.createPostsTags(exportData.data.posts[0].id, '100'),
|
||||
testUtils.DataGenerator.forKnex.createPostsTags(exportData.data.posts[0].id, '200'),
|
||||
testUtils.DataGenerator.forKnex.createPostsTags(exportData.data.posts[0].id, '200')
|
||||
];
|
||||
|
||||
return dataImporter.doImport(exportData, importOptions)
|
||||
@ -521,8 +521,8 @@ describe('Integration: Importer', function () {
|
||||
|
||||
importedData.length.should.equal(2, 'Did not get data successfully');
|
||||
|
||||
const users = importedData[0].data.map((model) => model.toJSON());
|
||||
const posts = importedData[1].data.map((model) => model.toJSON());
|
||||
const users = importedData[0].data.map(model => model.toJSON());
|
||||
const posts = importedData[1].data.map(model => model.toJSON());
|
||||
|
||||
posts.length.should.equal(1, 'Wrong number of posts');
|
||||
users.length.should.equal(2, 'Wrong number of users');
|
||||
@ -583,11 +583,11 @@ describe('Integration: Importer', function () {
|
||||
.then(function () {
|
||||
return Promise.all([
|
||||
models.Post.findPage(Object.assign({withRelated: ['tags']}, testUtils.context.internal)),
|
||||
models.Tag.findPage(Object.assign({order: 'slug ASC'}, testUtils.context.internal)),
|
||||
models.Tag.findPage(Object.assign({order: 'slug ASC'}, testUtils.context.internal))
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const posts = result[0].data.map((model) => model.toJSON());
|
||||
const tags = result[1].data.map((model) => model.toJSON());
|
||||
const posts = result[0].data.map(model => model.toJSON());
|
||||
const tags = result[1].data.map(model => model.toJSON());
|
||||
|
||||
posts.length.should.equal(exportData.data.posts.length, 'Wrong number of posts');
|
||||
|
||||
@ -633,7 +633,7 @@ describe('Integration: Importer', function () {
|
||||
exportData.data.roles_users = [
|
||||
testUtils.DataGenerator.forKnex.createUsersRoles(exportData.data.users[0].id, exportData.data.roles[0].id),
|
||||
testUtils.DataGenerator.forKnex.createUsersRoles(exportData.data.users[2].id, exportData.data.roles[2].id),
|
||||
testUtils.DataGenerator.forKnex.createUsersRoles(exportData.data.users[3].id, exportData.data.roles[4].id),
|
||||
testUtils.DataGenerator.forKnex.createUsersRoles(exportData.data.users[3].id, exportData.data.roles[4].id)
|
||||
];
|
||||
|
||||
exportData.data.posts[0] = testUtils.DataGenerator.forKnex.createPost({
|
||||
@ -642,7 +642,7 @@ describe('Integration: Importer', function () {
|
||||
author_id: exportData.data.users[0].id,
|
||||
created_by: exportData.data.users[0].id,
|
||||
updated_by: exportData.data.users[1].id,
|
||||
published_by: exportData.data.users[1].id,
|
||||
published_by: exportData.data.users[1].id
|
||||
});
|
||||
exportData.data.posts[1] = testUtils.DataGenerator.forKnex.createPost({
|
||||
slug: 'post2',
|
||||
@ -650,7 +650,7 @@ describe('Integration: Importer', function () {
|
||||
author_id: exportData.data.users[3].id,
|
||||
created_by: exportData.data.users[2].id,
|
||||
updated_by: exportData.data.users[0].id,
|
||||
published_by: exportData.data.users[1].id,
|
||||
published_by: exportData.data.users[1].id
|
||||
});
|
||||
exportData.data.posts[2] = testUtils.DataGenerator.forKnex.createPost({
|
||||
slug: 'post3',
|
||||
@ -658,7 +658,7 @@ describe('Integration: Importer', function () {
|
||||
author_id: exportData.data.users[0].id,
|
||||
created_by: exportData.data.users[3].id,
|
||||
updated_by: exportData.data.users[3].id,
|
||||
published_by: exportData.data.users[3].id,
|
||||
published_by: exportData.data.users[3].id
|
||||
});
|
||||
|
||||
exportData.data.tags[0] = testUtils.DataGenerator.forKnex.createTag({
|
||||
@ -689,9 +689,9 @@ describe('Integration: Importer', function () {
|
||||
models.User.findPage(userOptions)
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const posts = result[0].data.map((model) => model.toJSON(postOptions));
|
||||
const tags = result[1].data.map((model) => model.toJSON(tagOptions));
|
||||
const users = result[2].data.map((model) => model.toJSON(userOptions));
|
||||
const posts = result[0].data.map(model => model.toJSON(postOptions));
|
||||
const tags = result[1].data.map(model => model.toJSON(tagOptions));
|
||||
const users = result[2].data.map(model => model.toJSON(userOptions));
|
||||
|
||||
posts.length.should.equal(exportData.data.posts.length, 'Wrong number of posts');
|
||||
|
||||
@ -790,7 +790,7 @@ describe('Integration: Importer', function () {
|
||||
|
||||
exportData.data.roles_users = [
|
||||
testUtils.DataGenerator.forKnex.createUsersRoles(exportData.data.users[0].id, exportData.data.roles[0].id),
|
||||
testUtils.DataGenerator.forKnex.createUsersRoles(exportData.data.users[0].id, exportData.data.roles[4].id),
|
||||
testUtils.DataGenerator.forKnex.createUsersRoles(exportData.data.users[0].id, exportData.data.roles[4].id)
|
||||
];
|
||||
|
||||
return dataImporter.doImport(exportData, importOptions)
|
||||
@ -799,7 +799,7 @@ describe('Integration: Importer', function () {
|
||||
models.User.findPage(Object.assign({withRelated: ['roles']}, testUtils.context.internal))
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const users = result[0].data.map((model) => model.toJSON());
|
||||
const users = result[0].data.map(model => model.toJSON());
|
||||
|
||||
users.length.should.eql(2);
|
||||
users[1].slug.should.eql(exportData.data.users[0].slug);
|
||||
@ -831,8 +831,8 @@ describe('Integration: Importer', function () {
|
||||
models.Post.findPage(Object.assign({withRelated: ['tags']}, testUtils.context.internal))
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const tags = result[0].data.map((model) => model.toJSON());
|
||||
const posts = result[1].data.map((model) => model.toJSON());
|
||||
const tags = result[0].data.map(model => model.toJSON());
|
||||
const posts = result[1].data.map(model => model.toJSON());
|
||||
|
||||
posts.length.should.eql(1);
|
||||
tags.length.should.eql(1);
|
||||
@ -942,7 +942,7 @@ describe('Integration: Importer', function () {
|
||||
models.Post.findPage(testUtils.context.internal)
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const posts = result[0].data.map((model) => model.toJSON());
|
||||
const posts = result[0].data.map(model => model.toJSON());
|
||||
|
||||
posts.length.should.eql(2);
|
||||
posts[0].comment_id.should.eql(exportData.data.posts[1].id);
|
||||
@ -1017,7 +1017,7 @@ describe('Integration: Importer', function () {
|
||||
testUtils.DataGenerator.forKnex.createPostsAuthors(exportData.data.posts[2].id, exportData.data.users[4].id, 2),
|
||||
testUtils.DataGenerator.forKnex.createPostsAuthors(exportData.data.posts[2].id, exportData.data.users[4].id, 2),
|
||||
|
||||
testUtils.DataGenerator.forKnex.createPostsAuthors(exportData.data.posts[1].id, exportData.data.users[5].id),
|
||||
testUtils.DataGenerator.forKnex.createPostsAuthors(exportData.data.posts[1].id, exportData.data.users[5].id)
|
||||
];
|
||||
|
||||
delete exportData.data.posts_authors[9].sort_order;
|
||||
@ -1034,8 +1034,8 @@ describe('Integration: Importer', function () {
|
||||
models.User.findPage(testUtils.context.internal)
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const posts = result[0].data.map((model) => model.toJSON());
|
||||
const users = result[1].data.map((model) => model.toJSON());
|
||||
const posts = result[0].data.map(model => model.toJSON());
|
||||
const users = result[1].data.map(model => model.toJSON());
|
||||
|
||||
// 2 duplicates, 1 owner, 4 imported users
|
||||
users.length.should.eql(exportData.data.users.length - 2 + 1);
|
||||
@ -1063,7 +1063,7 @@ describe('Integration: Importer', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('import 2.0 Koenig post format', ()=> {
|
||||
it('import 2.0 Koenig post format', () => {
|
||||
const exportData = exportedLatestBody().db[0];
|
||||
|
||||
exportData.data.posts[0] = testUtils.DataGenerator.forKnex.createPost({
|
||||
@ -1075,7 +1075,7 @@ describe('Integration: Importer', function () {
|
||||
cards: [
|
||||
['image', {
|
||||
src: 'source',
|
||||
cardWidth: 'wide',
|
||||
cardWidth: 'wide'
|
||||
}],
|
||||
['markdown', {
|
||||
cardName: 'markdown',
|
||||
@ -1117,7 +1117,7 @@ describe('Integration: Importer', function () {
|
||||
models.Post.findPage(options)
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const posts = result[0].data.map((model) => model.toJSON(options));
|
||||
const posts = result[0].data.map(model => model.toJSON(options));
|
||||
|
||||
posts.length.should.eql(2);
|
||||
|
||||
@ -1167,7 +1167,7 @@ describe('Integration: Importer', function () {
|
||||
exportData.data.roles_users = [
|
||||
testUtils.DataGenerator.forKnex.createUsersRoles(exportData.data.users[0].id, exportData.data.roles[0].id),
|
||||
testUtils.DataGenerator.forKnex.createUsersRoles(exportData.data.users[2].id, exportData.data.roles[2].id),
|
||||
testUtils.DataGenerator.forKnex.createUsersRoles(exportData.data.users[3].id, exportData.data.roles[4].id),
|
||||
testUtils.DataGenerator.forKnex.createUsersRoles(exportData.data.users[3].id, exportData.data.roles[4].id)
|
||||
];
|
||||
|
||||
exportData.data.posts[0] = testUtils.DataGenerator.forKnex.createPost({
|
||||
@ -1176,7 +1176,7 @@ describe('Integration: Importer', function () {
|
||||
author_id: exportData.data.users[0].id,
|
||||
created_by: exportData.data.users[0].id,
|
||||
updated_by: exportData.data.users[1].id,
|
||||
published_by: exportData.data.users[1].id,
|
||||
published_by: exportData.data.users[1].id
|
||||
});
|
||||
exportData.data.posts[1] = testUtils.DataGenerator.forKnex.createPost({
|
||||
slug: 'post2',
|
||||
@ -1184,7 +1184,7 @@ describe('Integration: Importer', function () {
|
||||
author_id: exportData.data.users[3].id,
|
||||
created_by: exportData.data.users[2].id,
|
||||
updated_by: exportData.data.users[0].id,
|
||||
published_by: exportData.data.users[1].id,
|
||||
published_by: exportData.data.users[1].id
|
||||
});
|
||||
exportData.data.posts[2] = testUtils.DataGenerator.forKnex.createPost({
|
||||
slug: 'post3',
|
||||
@ -1192,7 +1192,7 @@ describe('Integration: Importer', function () {
|
||||
author_id: exportData.data.users[0].id,
|
||||
created_by: exportData.data.users[3].id,
|
||||
updated_by: exportData.data.users[3].id,
|
||||
published_by: exportData.data.users[3].id,
|
||||
published_by: exportData.data.users[3].id
|
||||
});
|
||||
|
||||
exportData.data.tags[0] = testUtils.DataGenerator.forKnex.createTag({
|
||||
@ -1258,9 +1258,9 @@ describe('Integration: Importer', function () {
|
||||
models.ClientTrustedDomain.findAll(testUtils.context.internal)
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const posts = result[0].data.map((model) => model.toJSON(postOptions));
|
||||
const tags = result[1].data.map((model) => model.toJSON(tagOptions));
|
||||
const users = result[2].data.map((model) => model.toJSON(userOptions));
|
||||
const posts = result[0].data.map(model => model.toJSON(postOptions));
|
||||
const tags = result[1].data.map(model => model.toJSON(tagOptions));
|
||||
const users = result[2].data.map(model => model.toJSON(userOptions));
|
||||
|
||||
let clients = result[3];
|
||||
let trustedDomains = result[4];
|
||||
@ -1325,7 +1325,7 @@ describe('1.0', function () {
|
||||
models.Post.findPage(testUtils.context.internal)
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const posts = result[0].data.map((model) => model.toJSON());
|
||||
const posts = result[0].data.map(model => model.toJSON());
|
||||
|
||||
posts.length.should.eql(2);
|
||||
posts[0].comment_id.should.eql(exportData.data.posts[1].id);
|
||||
@ -1334,7 +1334,7 @@ describe('1.0', function () {
|
||||
});
|
||||
|
||||
describe('migrate mobiledoc/html', () => {
|
||||
it('invalid mobiledoc structure', ()=> {
|
||||
it('invalid mobiledoc structure', () => {
|
||||
const exportData = exportedPreviousBody().db[0];
|
||||
|
||||
exportData.data.posts[0] = testUtils.DataGenerator.forKnex.createPost({
|
||||
@ -1356,7 +1356,7 @@ describe('1.0', function () {
|
||||
models.Post.findPage(options)
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const posts = result[0].data.map((model) => model.toJSON(options));
|
||||
const posts = result[0].data.map(model => model.toJSON(options));
|
||||
|
||||
posts.length.should.eql(2);
|
||||
should(posts[0].html).eql(null);
|
||||
@ -1367,7 +1367,7 @@ describe('1.0', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('mobiledoc is null, html field is set', ()=> {
|
||||
it('mobiledoc is null, html field is set', () => {
|
||||
const exportData = exportedPreviousBody().db[0];
|
||||
|
||||
exportData.data.posts[0] = testUtils.DataGenerator.forKnex.createPost({
|
||||
@ -1385,7 +1385,7 @@ describe('1.0', function () {
|
||||
models.Post.findPage(options)
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const posts = result[0].data.map((model) => model.toJSON(options));
|
||||
const posts = result[0].data.map(model => model.toJSON(options));
|
||||
|
||||
posts.length.should.eql(1);
|
||||
should(posts[0].html).eql(null);
|
||||
@ -1411,7 +1411,7 @@ describe('1.0', function () {
|
||||
models.Post.findPage(options)
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const posts = result[0].data.map((model) => model.toJSON(options));
|
||||
const posts = result[0].data.map(model => model.toJSON(options));
|
||||
|
||||
posts.length.should.eql(1);
|
||||
should(posts[0].html).eql(null);
|
||||
@ -1436,7 +1436,7 @@ describe('1.0', function () {
|
||||
models.Post.findPage(options)
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const posts = result[0].data.map((model) => model.toJSON(options));
|
||||
const posts = result[0].data.map(model => model.toJSON(options));
|
||||
|
||||
posts.length.should.eql(1);
|
||||
posts[0].html.should.eql('<!--kg-card-begin: markdown--><h2 id="markdown">markdown</h2>\n<!--kg-card-end: markdown-->');
|
||||
@ -1444,7 +1444,7 @@ describe('1.0', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('post has "kg-card-markdown" class', ()=> {
|
||||
it('post has "kg-card-markdown" class', () => {
|
||||
const exportData = exportedPreviousBody().db[0];
|
||||
|
||||
exportData.data.posts[0] = testUtils.DataGenerator.forKnex.createPost({
|
||||
@ -1461,7 +1461,7 @@ describe('1.0', function () {
|
||||
models.Post.findPage(options)
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const posts = result[0].data.map((model) => model.toJSON(options));
|
||||
const posts = result[0].data.map(model => model.toJSON(options));
|
||||
|
||||
posts.length.should.eql(1);
|
||||
posts[0].html.should.eql('<!--kg-card-begin: markdown--><h1 id="thisismypostcontent">This is my post content</h1>\n<!--kg-card-end: markdown-->');
|
||||
@ -1469,7 +1469,7 @@ describe('1.0', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('import old Koenig Beta post format', ()=> {
|
||||
it('import old Koenig Beta post format', () => {
|
||||
const exportData = exportedPreviousBody().db[0];
|
||||
|
||||
exportData.data.posts[0] = testUtils.DataGenerator.forKnex.createPost({
|
||||
@ -1523,7 +1523,7 @@ describe('1.0', function () {
|
||||
models.Post.findPage(options)
|
||||
]);
|
||||
}).then(function (result) {
|
||||
const posts = result[0].data.map((model) => model.toJSON(options));
|
||||
const posts = result[0].data.map(model => model.toJSON(options));
|
||||
|
||||
posts.length.should.eql(2);
|
||||
|
||||
|
@ -1348,7 +1348,7 @@ describe('Post Model', function () {
|
||||
|
||||
return models.MobiledocRevision
|
||||
.findAll({
|
||||
filter: `post_id:${updatedPost.id}`,
|
||||
filter: `post_id:${updatedPost.id}`
|
||||
});
|
||||
})
|
||||
.then((mobiledocRevisions) => {
|
||||
@ -1383,7 +1383,7 @@ describe('Post Model', function () {
|
||||
})
|
||||
.then(() => models.MobiledocRevision
|
||||
.findAll({
|
||||
filter: `post_id:${revisionedPost.id}`,
|
||||
filter: `post_id:${revisionedPost.id}`
|
||||
})
|
||||
)
|
||||
.then((mobiledocRevisions) => {
|
||||
@ -1413,7 +1413,7 @@ describe('Post Model', function () {
|
||||
|
||||
return models.MobiledocRevision
|
||||
.findAll({
|
||||
filter: `post_id:${createdPost.id}`,
|
||||
filter: `post_id:${createdPost.id}`
|
||||
});
|
||||
})
|
||||
.then((mobiledocRevisions) => {
|
||||
@ -1429,7 +1429,7 @@ describe('Post Model', function () {
|
||||
|
||||
return models.MobiledocRevision
|
||||
.findAll({
|
||||
filter: `post_id:${editedPost.id}`,
|
||||
filter: `post_id:${editedPost.id}`
|
||||
});
|
||||
})
|
||||
.then((mobiledocRevisions) => {
|
||||
|
@ -3,7 +3,7 @@ const shared = require('../../../../server/api/shared');
|
||||
|
||||
describe('Unit: api/shared/headers', function () {
|
||||
it('empty headers config', function () {
|
||||
return shared.headers.get().then(result => {
|
||||
return shared.headers.get().then((result) => {
|
||||
result.should.eql({});
|
||||
});
|
||||
});
|
||||
@ -11,7 +11,7 @@ describe('Unit: api/shared/headers', function () {
|
||||
describe('config.disposition', function () {
|
||||
it('json', function () {
|
||||
return shared.headers.get({}, {disposition: {type: 'json', value: 'value'}})
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
result.should.eql({
|
||||
'Content-Disposition': 'Attachment; filename=\"value\"',
|
||||
'Content-Type': 'application/json',
|
||||
@ -22,7 +22,7 @@ describe('Unit: api/shared/headers', function () {
|
||||
|
||||
it('csv', function () {
|
||||
return shared.headers.get({}, {disposition: {type: 'csv', value: 'my.csv'}})
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
result.should.eql({
|
||||
'Content-Disposition': 'Attachment; filename=\"my.csv\"',
|
||||
'Content-Type': 'text/csv'
|
||||
@ -32,7 +32,7 @@ describe('Unit: api/shared/headers', function () {
|
||||
|
||||
it('yaml', function () {
|
||||
return shared.headers.get('yaml file', {disposition: {type: 'yaml', value: 'my.yaml'}})
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
result.should.eql({
|
||||
'Content-Disposition': 'Attachment; filename=\"my.yaml\"',
|
||||
'Content-Type': 'application/yaml',
|
||||
@ -45,7 +45,7 @@ describe('Unit: api/shared/headers', function () {
|
||||
describe('config.cacheInvalidate', function () {
|
||||
it('default', function () {
|
||||
return shared.headers.get({}, {cacheInvalidate: true})
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
result.should.eql({
|
||||
'X-Cache-Invalidate': '/*'
|
||||
});
|
||||
@ -54,7 +54,7 @@ describe('Unit: api/shared/headers', function () {
|
||||
|
||||
it('custom value', function () {
|
||||
return shared.headers.get({}, {cacheInvalidate: {value: 'value'}})
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
result.should.eql({
|
||||
'X-Cache-Invalidate': 'value'
|
||||
});
|
||||
|
@ -29,8 +29,12 @@ describe('Unit: api/shared/validators/handle', function () {
|
||||
it('ensure validators are called', function () {
|
||||
const getStub = sinon.stub();
|
||||
const addStub = sinon.stub();
|
||||
sinon.stub(shared.validators.input.all, 'all').get(() => {return getStub;});
|
||||
sinon.stub(shared.validators.input.all, 'add').get(() => {return addStub;});
|
||||
sinon.stub(shared.validators.input.all, 'all').get(() => {
|
||||
return getStub;
|
||||
});
|
||||
sinon.stub(shared.validators.input.all, 'add').get(() => {
|
||||
return addStub;
|
||||
});
|
||||
|
||||
const apiValidators = {
|
||||
all: {
|
||||
|
@ -41,7 +41,7 @@ describe('Unit: api/shared/validators/input/all', function () {
|
||||
it('should run global validations on an type that has validation defined', function () {
|
||||
const frame = {
|
||||
options: {
|
||||
slug: 'not a valid slug %%%%% http://',
|
||||
slug: 'not a valid slug %%%%% http://'
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -18,7 +18,7 @@ describe('Unit: api:v0.1:decorators:urls', function () {
|
||||
it('does not add any extra keys to an object', function () {
|
||||
const object = {};
|
||||
const options = {
|
||||
columns: [],
|
||||
columns: []
|
||||
};
|
||||
|
||||
urls.urlsForPost(1, object, options);
|
||||
|
@ -9,7 +9,7 @@ describe('Unit: v2/utils/serializers/input/pages', function () {
|
||||
apiType: 'content',
|
||||
options: {
|
||||
context: {}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
serializers.input.pages.browse(apiConfig, frame);
|
||||
@ -100,7 +100,7 @@ describe('Unit: v2/utils/serializers/input/pages', function () {
|
||||
api_key: {
|
||||
id: 1,
|
||||
type: 'content'
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
data: {}
|
||||
@ -120,7 +120,7 @@ describe('Unit: v2/utils/serializers/input/pages', function () {
|
||||
api_key: {
|
||||
id: 1,
|
||||
type: 'admin'
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
data: {}
|
||||
@ -156,7 +156,7 @@ describe('Unit: v2/utils/serializers/input/pages', function () {
|
||||
api_key: {
|
||||
id: 1,
|
||||
type: 'admin'
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
data: {}
|
||||
@ -222,7 +222,7 @@ describe('Unit: v2/utils/serializers/input/pages', function () {
|
||||
{
|
||||
id: 'id1',
|
||||
authors: ['email1', 'email2'],
|
||||
tags: ['name1', 'name2'],
|
||||
tags: ['name1', 'name2']
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ describe('Unit: v2/utils/serializers/input/posts', function () {
|
||||
api_key: {
|
||||
id: 1,
|
||||
type: 'content'
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -49,7 +49,7 @@ describe('Unit: v2/utils/serializers/input/posts', function () {
|
||||
api_key: {
|
||||
id: 1,
|
||||
type: 'content'
|
||||
},
|
||||
}
|
||||
},
|
||||
filter: 'status:published+tag:eins'
|
||||
}
|
||||
@ -69,7 +69,7 @@ describe('Unit: v2/utils/serializers/input/posts', function () {
|
||||
api_key: {
|
||||
id: 1,
|
||||
type: 'content'
|
||||
},
|
||||
}
|
||||
},
|
||||
filter: 'page:true+tag:eins'
|
||||
}
|
||||
@ -89,7 +89,7 @@ describe('Unit: v2/utils/serializers/input/posts', function () {
|
||||
api_key: {
|
||||
id: 1,
|
||||
type: 'content'
|
||||
},
|
||||
}
|
||||
},
|
||||
filter: 'page:true'
|
||||
}
|
||||
@ -109,7 +109,7 @@ describe('Unit: v2/utils/serializers/input/posts', function () {
|
||||
api_key: {
|
||||
id: 1,
|
||||
type: 'content'
|
||||
},
|
||||
}
|
||||
},
|
||||
filter: '(page:true,page:false)'
|
||||
}
|
||||
@ -243,8 +243,8 @@ describe('Unit: v2/utils/serializers/input/posts', function () {
|
||||
api_key: {
|
||||
id: 1,
|
||||
type: 'content'
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
data: {
|
||||
posts: [
|
||||
@ -271,8 +271,8 @@ describe('Unit: v2/utils/serializers/input/posts', function () {
|
||||
api_key: {
|
||||
id: 1,
|
||||
type: 'content'
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
data: {
|
||||
posts: [
|
||||
@ -299,7 +299,7 @@ describe('Unit: v2/utils/serializers/input/posts', function () {
|
||||
api_key: {
|
||||
id: 1,
|
||||
type: 'content'
|
||||
},
|
||||
}
|
||||
},
|
||||
withRelated: ['tags', 'authors']
|
||||
},
|
||||
@ -354,7 +354,7 @@ describe('Unit: v2/utils/serializers/input/posts', function () {
|
||||
api_key: {
|
||||
id: 1,
|
||||
type: 'content'
|
||||
},
|
||||
}
|
||||
},
|
||||
withRelated: ['tags', 'authors']
|
||||
},
|
||||
@ -471,7 +471,7 @@ describe('Unit: v2/utils/serializers/input/posts', function () {
|
||||
posts: [
|
||||
{
|
||||
id: 'id1',
|
||||
html: '<p>this is great feature</p>\n<!--kg-card-begin: html--><div class="custom">My Custom HTML</div><!--kg-card-end: html-->\n<p>custom html preserved!</p>',
|
||||
html: '<p>this is great feature</p>\n<!--kg-card-begin: html--><div class="custom">My Custom HTML</div><!--kg-card-end: html-->\n<p>custom html preserved!</p>'
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -517,7 +517,7 @@ describe('Unit: v2/utils/serializers/input/posts', function () {
|
||||
{
|
||||
id: 'id1',
|
||||
authors: ['email1', 'email2'],
|
||||
tags: ['name1', 'name2'],
|
||||
tags: ['name1', 'name2']
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ describe('Unit: v2/utils/serializers/output/utils/mapper', () => {
|
||||
const frame = {
|
||||
options: {
|
||||
context: {}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
const tag = tagModel(testUtils.DataGenerator.forKnex.createTag({
|
||||
@ -156,7 +156,7 @@ describe('Unit: v2/utils/serializers/output/utils/mapper', () => {
|
||||
|
||||
should.exist(mapped.api_keys);
|
||||
|
||||
mapped.api_keys.forEach(key => {
|
||||
mapped.api_keys.forEach((key) => {
|
||||
if (key.type === 'admin') {
|
||||
const [id, secret] = key.secret.split(':');
|
||||
should.exist(id);
|
||||
|
@ -28,7 +28,7 @@ describe('Unit: v2/utils/serializers/output/utils/url', () => {
|
||||
it('meta & models & relations', () => {
|
||||
const post = pageModel(testUtils.DataGenerator.forKnex.createPost({
|
||||
id: 'id1',
|
||||
feature_image: 'value',
|
||||
feature_image: 'value'
|
||||
}));
|
||||
|
||||
urlUtil.forPost(post.id, post, {options: {}});
|
||||
|
@ -81,7 +81,7 @@ describe('Unit: v2/utils/validators/input/pages', function () {
|
||||
data: {
|
||||
pages: [{
|
||||
what: 'a fail'
|
||||
}],
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
@ -99,7 +99,7 @@ describe('Unit: v2/utils/validators/input/pages', function () {
|
||||
pages: [{
|
||||
title: 'pass',
|
||||
authors: [{id: 'correct'}]
|
||||
}],
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
@ -118,7 +118,7 @@ describe('Unit: v2/utils/validators/input/pages', function () {
|
||||
created_by: 'strip me',
|
||||
updated_by: 'strip me',
|
||||
published_by: 'strip me'
|
||||
}],
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
@ -147,10 +147,10 @@ describe('Unit: v2/utils/validators/input/pages', function () {
|
||||
locale: [123, new Date(), _.repeat('a', 7)],
|
||||
visibility: [123, new Date(), 'abc'],
|
||||
meta_title: [123, new Date(), _.repeat('a', 301)],
|
||||
meta_description: [123, new Date(), _.repeat('a', 501)],
|
||||
meta_description: [123, new Date(), _.repeat('a', 501)]
|
||||
};
|
||||
|
||||
Object.keys(fieldMap).forEach(key => {
|
||||
Object.keys(fieldMap).forEach((key) => {
|
||||
it(`should fail for bad ${key}`, function () {
|
||||
const badValues = fieldMap[key];
|
||||
|
||||
@ -302,7 +302,7 @@ describe('Unit: v2/utils/validators/input/pages', function () {
|
||||
pages: [{
|
||||
title: 'pass',
|
||||
updated_at: new Date().toISOString()
|
||||
}],
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -81,7 +81,7 @@ describe('Unit: v2/utils/validators/input/posts', function () {
|
||||
data: {
|
||||
posts: [{
|
||||
what: 'a fail'
|
||||
}],
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
@ -99,7 +99,7 @@ describe('Unit: v2/utils/validators/input/posts', function () {
|
||||
posts: [{
|
||||
title: 'pass',
|
||||
authors: [{id: 'correct'}]
|
||||
}],
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
@ -118,7 +118,7 @@ describe('Unit: v2/utils/validators/input/posts', function () {
|
||||
created_by: 'strip me',
|
||||
updated_by: 'strip me',
|
||||
published_by: 'strip me'
|
||||
}],
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
@ -147,10 +147,10 @@ describe('Unit: v2/utils/validators/input/posts', function () {
|
||||
locale: [123, new Date(), _.repeat('a', 7)],
|
||||
visibility: [123, new Date(), 'abc'],
|
||||
meta_title: [123, new Date(), _.repeat('a', 301)],
|
||||
meta_description: [123, new Date(), _.repeat('a', 501)],
|
||||
meta_description: [123, new Date(), _.repeat('a', 501)]
|
||||
};
|
||||
|
||||
Object.keys(fieldMap).forEach(key => {
|
||||
Object.keys(fieldMap).forEach((key) => {
|
||||
it(`should fail for bad ${key}`, function () {
|
||||
const badValues = fieldMap[key];
|
||||
|
||||
@ -302,7 +302,7 @@ describe('Unit: v2/utils/validators/input/posts', function () {
|
||||
posts: [{
|
||||
title: 'pass',
|
||||
updated_at: new Date().toISOString()
|
||||
}],
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -81,7 +81,7 @@ describe('Unit: v2/utils/validators/input/tags', function () {
|
||||
data: {
|
||||
tags: [{
|
||||
what: 'a fail'
|
||||
}],
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
@ -98,7 +98,7 @@ describe('Unit: v2/utils/validators/input/tags', function () {
|
||||
data: {
|
||||
tags: [{
|
||||
name: 'pass'
|
||||
}],
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
@ -116,7 +116,7 @@ describe('Unit: v2/utils/validators/input/tags', function () {
|
||||
created_by: 'strip me',
|
||||
updated_at: 'strip me',
|
||||
updated_by: 'strip me'
|
||||
}],
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
@ -144,7 +144,7 @@ describe('Unit: v2/utils/validators/input/tags', function () {
|
||||
meta_description: [123, new Date(), _.repeat('a', 501)]
|
||||
};
|
||||
|
||||
Object.keys(fieldMap).forEach(key => {
|
||||
Object.keys(fieldMap).forEach((key) => {
|
||||
it(`should fail for bad ${key}`, function () {
|
||||
const badValues = fieldMap[key];
|
||||
|
||||
@ -232,7 +232,7 @@ describe('Unit: v2/utils/validators/input/tags', function () {
|
||||
data: {
|
||||
tags: [{
|
||||
name: 'pass'
|
||||
}],
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
/*globals describe, beforeEach, afterEach, it*/
|
||||
var should = require('should'),
|
||||
sinon = require('sinon'),
|
||||
path = require('path'),
|
||||
|
@ -1,4 +1,3 @@
|
||||
/*globals describe, beforeEach, afterEach, it*/
|
||||
var should = require('should'),
|
||||
sinon = require('sinon'),
|
||||
crypto = require('crypto'),
|
||||
|
@ -104,7 +104,7 @@ describe('getTitle', function () {
|
||||
pagination: {
|
||||
total: 40,
|
||||
page: 23
|
||||
},
|
||||
}
|
||||
}, {
|
||||
hash: {
|
||||
page: ' p.%'
|
||||
|
@ -71,14 +71,14 @@ describe('{{ghost_head}} helper', function () {
|
||||
}));
|
||||
|
||||
/** AUTHORS - related to posts */
|
||||
authors.push(createUser({ // Author 0
|
||||
authors.push(createUser({// Author 0
|
||||
profile_image: '/content/images/test-author-image.png',
|
||||
website: 'http://authorwebsite.com',
|
||||
facebook: 'testuser',
|
||||
twitter: '@testuser',
|
||||
twitter: '@testuser'
|
||||
}));
|
||||
|
||||
authors.push(createUser({ // Author 1
|
||||
authors.push(createUser({// Author 1
|
||||
name: 'Author name',
|
||||
slug: 'author2',
|
||||
profile_image: '/content/images/test-author-image.png',
|
||||
@ -88,7 +88,7 @@ describe('{{ghost_head}} helper', function () {
|
||||
twitter: '@testuser'
|
||||
}));
|
||||
|
||||
authors.push(createUser({ // Author 2
|
||||
authors.push(createUser({// Author 2
|
||||
name: 'Author name',
|
||||
slug: 'author3',
|
||||
profile_image: '/content/images/test-author-image.png',
|
||||
@ -98,7 +98,7 @@ describe('{{ghost_head}} helper', function () {
|
||||
bio: 'Author bio'
|
||||
}));
|
||||
|
||||
authors.push(createUser({ // Author 3
|
||||
authors.push(createUser({// Author 3
|
||||
name: 'Author name',
|
||||
url: 'http://testauthorurl.com',
|
||||
slug: 'author4',
|
||||
@ -108,11 +108,11 @@ describe('{{ghost_head}} helper', function () {
|
||||
twitter: '@testuser'
|
||||
}));
|
||||
|
||||
authors.push(createUser({ // Author 4
|
||||
authors.push(createUser({// Author 4
|
||||
name: 'Author name'
|
||||
}));
|
||||
|
||||
authors.push(createUser({ // Author 5
|
||||
authors.push(createUser({// Author 5
|
||||
name: 'Author name',
|
||||
url: 'http://testauthorurl.com',
|
||||
slug: 'author8',
|
||||
@ -124,7 +124,7 @@ describe('{{ghost_head}} helper', function () {
|
||||
|
||||
/** POSTS */
|
||||
|
||||
posts.push(createPost({ // Post 0
|
||||
posts.push(createPost({// Post 0
|
||||
meta_description: 'all about our blog',
|
||||
title: 'About',
|
||||
feature_image: '/content/images/test-image-about.png',
|
||||
@ -133,7 +133,7 @@ describe('{{ghost_head}} helper', function () {
|
||||
primary_author: authors[0]
|
||||
}));
|
||||
|
||||
posts.push(createPost({ // Post 1
|
||||
posts.push(createPost({// Post 1
|
||||
meta_description: 'all about our blog',
|
||||
title: 'About',
|
||||
feature_image: '/content/images/test-image-about.png',
|
||||
@ -148,7 +148,7 @@ describe('{{ghost_head}} helper', function () {
|
||||
primary_author: authors[0]
|
||||
}));
|
||||
|
||||
posts.push(createPost({ // Post 2
|
||||
posts.push(createPost({// Post 2
|
||||
meta_description: 'blog description',
|
||||
title: 'Welcome to Ghost',
|
||||
feature_image: '/content/images/test-image.png',
|
||||
@ -166,7 +166,7 @@ describe('{{ghost_head}} helper', function () {
|
||||
primary_author: authors[1]
|
||||
}));
|
||||
|
||||
posts.push(createPost({ // Post 3
|
||||
posts.push(createPost({// Post 3
|
||||
meta_description: 'blog description',
|
||||
custom_excerpt: 'post custom excerpt',
|
||||
title: 'Welcome to Ghost',
|
||||
@ -185,7 +185,7 @@ describe('{{ghost_head}} helper', function () {
|
||||
primary_author: authors[2]
|
||||
}));
|
||||
|
||||
posts.push(createPost({ // Post 4
|
||||
posts.push(createPost({// Post 4
|
||||
title: 'Welcome to Ghost',
|
||||
mobiledoc: testUtils.DataGenerator.markdownToMobiledoc('This is a short post'),
|
||||
authors: [
|
||||
@ -194,7 +194,7 @@ describe('{{ghost_head}} helper', function () {
|
||||
primary_author: authors[3]
|
||||
}));
|
||||
|
||||
posts.push(createPost({ // Post 5
|
||||
posts.push(createPost({// Post 5
|
||||
meta_description: 'blog description',
|
||||
title: 'Welcome to Ghost',
|
||||
feature_image: '/content/images/test-image.png',
|
||||
@ -213,7 +213,7 @@ describe('{{ghost_head}} helper', function () {
|
||||
primary_author: authors[3]
|
||||
}));
|
||||
|
||||
posts.push(createPost({ // Post 6
|
||||
posts.push(createPost({// Post 6
|
||||
meta_description: 'blog "test" description',
|
||||
title: 'title',
|
||||
meta_title: 'Welcome to Ghost "test"',
|
||||
@ -229,7 +229,7 @@ describe('{{ghost_head}} helper', function () {
|
||||
primary_author: authors[3]
|
||||
}));
|
||||
|
||||
posts.push(createPost({ // Post 7
|
||||
posts.push(createPost({// Post 7
|
||||
meta_description: 'blog description',
|
||||
title: 'Welcome to Ghost',
|
||||
feature_image: '/content/images/test-image.png',
|
||||
@ -240,7 +240,7 @@ describe('{{ghost_head}} helper', function () {
|
||||
primary_author: authors[3]
|
||||
}));
|
||||
|
||||
posts.push(createPost({ // Post 8
|
||||
posts.push(createPost({// Post 8
|
||||
meta_description: 'blog description',
|
||||
title: 'Welcome to Ghost',
|
||||
feature_image: null,
|
||||
@ -255,7 +255,7 @@ describe('{{ghost_head}} helper', function () {
|
||||
primary_author: authors[5]
|
||||
}));
|
||||
|
||||
posts.push(createPost({ // Post 9
|
||||
posts.push(createPost({// Post 9
|
||||
title: 'Welcome to Ghost',
|
||||
mobiledoc: testUtils.DataGenerator.markdownToMobiledoc('This is a short post'),
|
||||
tags: [
|
||||
|
@ -128,7 +128,7 @@ describe('{{image}} helper', function () {
|
||||
it('should output correct url for absolute paths which are internal', function () {
|
||||
var rendered = helpers.img_url('http://localhost:82832/content/images/my-coole-img.jpg', {
|
||||
hash: {
|
||||
size: 'medium',
|
||||
size: 'medium'
|
||||
},
|
||||
data: {
|
||||
config: {
|
||||
@ -146,7 +146,7 @@ describe('{{image}} helper', function () {
|
||||
it('should output the correct url for protocol relative urls', function () {
|
||||
var rendered = helpers.img_url('//website.com/whatever/my-coole-img.jpg', {
|
||||
hash: {
|
||||
size: 'medium',
|
||||
size: 'medium'
|
||||
},
|
||||
data: {
|
||||
config: {
|
||||
@ -164,7 +164,7 @@ describe('{{image}} helper', function () {
|
||||
it('should output the correct url for relative paths', function () {
|
||||
var rendered = helpers.img_url('/content/images/my-coole-img.jpg', {
|
||||
hash: {
|
||||
size: 'medium',
|
||||
size: 'medium'
|
||||
},
|
||||
data: {
|
||||
config: {
|
||||
|
@ -48,7 +48,7 @@ describe('lib/image: manipulator', function () {
|
||||
sharpInstance = {
|
||||
resize: sinon.stub().returnsThis(),
|
||||
rotate: sinon.stub().returnsThis(),
|
||||
toBuffer: sinon.stub(),
|
||||
toBuffer: sinon.stub()
|
||||
};
|
||||
|
||||
sharp = sinon.stub().callsFake(() => {
|
||||
|
@ -122,7 +122,7 @@ describe('Gallery card', function () {
|
||||
{
|
||||
row: 0,
|
||||
fileName: 'NatGeo02.jpg',
|
||||
src: '/content/images/2018/08/NatGeo02-10.jpg',
|
||||
src: '/content/images/2018/08/NatGeo02-10.jpg'
|
||||
},
|
||||
{
|
||||
row: 0,
|
||||
|
@ -53,7 +53,7 @@ describe('Mobiledoc converter', function () {
|
||||
[10, 3],
|
||||
[10, 4],
|
||||
[10, 5],
|
||||
[1, 'p', []],
|
||||
[1, 'p', []]
|
||||
]
|
||||
};
|
||||
|
||||
|
@ -18,7 +18,7 @@ describe('Unit: lib/promise/sequence', function () {
|
||||
},
|
||||
function c() {
|
||||
return Promise.resolve('chio');
|
||||
},
|
||||
}
|
||||
];
|
||||
return sequence(tasks)
|
||||
.then(function (result) {
|
||||
|
@ -286,7 +286,7 @@ describe('Models: base', function () {
|
||||
life: 'suffering'
|
||||
};
|
||||
const unfilteredOptions = {
|
||||
id: 'something real special',
|
||||
id: 'something real special'
|
||||
};
|
||||
const model = models.Base.Model.forge({});
|
||||
const savedModel = models.Base.Model.forge({});
|
||||
@ -342,7 +342,7 @@ describe('Models: base', function () {
|
||||
db: 'cooper'
|
||||
};
|
||||
const unfilteredOptions = {
|
||||
id: 'something real special',
|
||||
id: 'something real special'
|
||||
};
|
||||
const model = models.Base.Model.forge({});
|
||||
const filterOptionsSpy = sinon.spy(models.Base.Model, 'filterOptions');
|
||||
|
@ -229,7 +229,7 @@ describe('Unit: models/post', function () {
|
||||
'published',
|
||||
'draft',
|
||||
'published',
|
||||
false,
|
||||
false
|
||||
]);
|
||||
|
||||
queries[1].sql.should.eql('select `posts`.* from `posts` where ((`posts`.`status` in (?, ?) and `posts`.`status` = ?) and (`posts`.`page` = ?)) order by CASE WHEN posts.status = \'scheduled\' THEN 1 WHEN posts.status = \'draft\' THEN 2 ELSE 3 END ASC,CASE WHEN posts.status != \'draft\' THEN posts.published_at END DESC,posts.updated_at DESC,posts.id DESC');
|
||||
@ -237,7 +237,7 @@ describe('Unit: models/post', function () {
|
||||
'published',
|
||||
'draft',
|
||||
'published',
|
||||
false,
|
||||
false
|
||||
]);
|
||||
});
|
||||
});
|
||||
@ -252,7 +252,7 @@ describe('Unit: models/post', function () {
|
||||
it('ensure mobiledoc revisions are never exposed', function () {
|
||||
const post = {
|
||||
mobiledoc: 'test',
|
||||
mobiledoc_revisions: [],
|
||||
mobiledoc_revisions: []
|
||||
};
|
||||
|
||||
const json = toJSON(post, {formats: ['mobiledoc']});
|
||||
|
@ -214,7 +214,7 @@ describe('Unit: models/session', function () {
|
||||
should.equal(findOneStub.args[0][1], filteredOptions);
|
||||
|
||||
should.deepEqual(editStub.args[0][0], {
|
||||
session_data: data.session_data,
|
||||
session_data: data.session_data
|
||||
});
|
||||
|
||||
should.deepEqual(editStub.args[0][1], {
|
||||
|
@ -13,7 +13,9 @@ describe.skip('Auth Service - Members', function () {
|
||||
describe('authenticateMembersToken', function () {
|
||||
it('calls next without an error if there is no authorization header', function () {
|
||||
members.authenticateMembersToken({
|
||||
get() { return null; }
|
||||
get() {
|
||||
return null;
|
||||
}
|
||||
}, {}, function next(err) {
|
||||
const actual = err;
|
||||
const expected = undefined;
|
||||
@ -24,7 +26,9 @@ describe.skip('Auth Service - Members', function () {
|
||||
|
||||
it('calls next without an error if the authorization header does not match the GhostMembers scheme', function () {
|
||||
members.authenticateMembersToken({
|
||||
get() { return 'DodgyScheme credscredscreds'; }
|
||||
get() {
|
||||
return 'DodgyScheme credscredscreds';
|
||||
}
|
||||
}, {}, function next(err) {
|
||||
const actual = err;
|
||||
const expected = undefined;
|
||||
@ -35,7 +39,9 @@ describe.skip('Auth Service - Members', function () {
|
||||
describe('attempts to verify the credentials as a JWT, allowing the "NONE" algorithm', function () {
|
||||
it('calls next with an UnauthorizedError if the verification fails', function () {
|
||||
members.authenticateMembersToken({
|
||||
get() { return 'GhostMembers notafuckentoken'; }
|
||||
get() {
|
||||
return 'GhostMembers notafuckentoken';
|
||||
}
|
||||
}, {}, function next(err) {
|
||||
const actual = err instanceof UnauthorizedError;
|
||||
const expected = true;
|
||||
@ -51,7 +57,9 @@ describe.skip('Auth Service - Members', function () {
|
||||
algorithm: 'none'
|
||||
});
|
||||
const req = {
|
||||
get() { return `GhostMembers ${token}`; }
|
||||
get() {
|
||||
return `GhostMembers ${token}`;
|
||||
}
|
||||
};
|
||||
members.authenticateMembersToken(req, {}, function next(err) {
|
||||
should.equal(err, undefined);
|
||||
|
@ -60,7 +60,7 @@ describe('Permissions', function () {
|
||||
it('should return api_key and public context if content api_key provided', function () {
|
||||
parseContext({api_key: {
|
||||
id: 1,
|
||||
type: 'content',
|
||||
type: 'content'
|
||||
}, integration: {id: 2}}).should.eql({
|
||||
internal: false,
|
||||
external: false,
|
||||
|
@ -165,7 +165,7 @@ describe('UNIT - services/routing/StaticRoutesRouter', function () {
|
||||
it('initialise with controller+data', function () {
|
||||
const staticRoutesRouter = new StaticRoutesRouter('/channel/', {
|
||||
controller: 'channel',
|
||||
data: {query: {}, router: {}},
|
||||
data: {query: {}, router: {}}
|
||||
});
|
||||
|
||||
should.not.exist(staticRoutesRouter.getFilter());
|
||||
|
@ -71,7 +71,7 @@ describe('UNIT > Settings Service ensure settings:', function () {
|
||||
fs.readFile.withArgs(path.join(__dirname, '../../../utils/fixtures/settings/routes.yaml'), 'utf8').rejects(fsError);
|
||||
|
||||
return ensureSettings(['routes'])
|
||||
.then(()=> {
|
||||
.then(() => {
|
||||
throw new Error('Expected test to fail');
|
||||
})
|
||||
.catch((error) => {
|
||||
|
@ -26,7 +26,7 @@ describe('UNIT > Settings Service:', function () {
|
||||
collections: {
|
||||
'/': {
|
||||
permalink: '/{slug}/',
|
||||
template: [ 'home', 'index' ]
|
||||
template: ['home', 'index']
|
||||
}
|
||||
},
|
||||
resources: {tag: '/tag/{slug}/', author: '/author/{slug}/'}
|
||||
@ -86,7 +86,7 @@ describe('UNIT > Settings Service:', function () {
|
||||
collections: {
|
||||
'/': {
|
||||
permalink: '/{slug}/',
|
||||
template: [ 'home', 'index' ]
|
||||
template: ['home', 'index']
|
||||
}
|
||||
},
|
||||
resources: {tag: '/tag/{slug}/', author: '/author/{slug}/'}
|
||||
|
@ -257,7 +257,7 @@ describe('UNIT: services/settings/validate', function () {
|
||||
},
|
||||
taxonomies: {
|
||||
tag: '/tags/{slug}/',
|
||||
author: '/authors/{slug}/',
|
||||
author: '/authors/{slug}/'
|
||||
}
|
||||
});
|
||||
|
||||
@ -611,7 +611,7 @@ describe('UNIT: services/settings/validate', function () {
|
||||
status: 'draft'
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -1038,7 +1038,7 @@ describe('UNIT: services/settings/validate', function () {
|
||||
},
|
||||
taxonomies: {
|
||||
tag: '/tags/{slug}/',
|
||||
author: '/authors/{slug}/',
|
||||
author: '/authors/{slug}/'
|
||||
}
|
||||
});
|
||||
|
||||
@ -1388,7 +1388,7 @@ describe('UNIT: services/settings/validate', function () {
|
||||
status: 'draft'
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -71,7 +71,7 @@ describe('Themes', function () {
|
||||
level: 'error',
|
||||
rule: 'Replace the <code>{{#if author.cover}}</code> helper with <code>{{#if author.cover_image}}</code>',
|
||||
details: 'The <code>cover</code> attribute was replaced with <code>cover_image</code>.<br>Instead of <code>{{#if author.cover}}</code> you need to use <code>{{#if author.cover_image}}</code>.<br>See the object attributes of <code>author</code> <a href="https://docs.ghost.org/api/handlebars-themes/context/author/#author-object-attributes" target=_blank>here</a>.',
|
||||
failures: [ {} ],
|
||||
failures: [{}],
|
||||
code: 'GS001-DEPR-CON-AC'
|
||||
}
|
||||
]
|
||||
@ -99,7 +99,7 @@ describe('Themes', function () {
|
||||
level: 'error',
|
||||
rule: 'Replace the <code>{{#if author.cover}}</code> helper with <code>{{#if author.cover_image}}</code>',
|
||||
details: 'The <code>cover</code> attribute was replaced with <code>cover_image</code>.<br>Instead of <code>{{#if author.cover}}</code> you need to use <code>{{#if author.cover_image}}</code>.<br>See the object attributes of <code>author</code> <a href="https://docs.ghost.org/api/handlebars-themes/context/author/#author-object-attributes" target=_blank>here</a>.',
|
||||
failures: [ {} ],
|
||||
failures: [{}],
|
||||
code: 'GS001-DEPR-CON-AC'
|
||||
}
|
||||
]
|
||||
|
@ -161,7 +161,7 @@ describe('cors', function () {
|
||||
|
||||
cors.__set__('urlUtils', urlUtils.getInstance({
|
||||
url: 'https://blog',
|
||||
adminUrl: origin,
|
||||
adminUrl: origin
|
||||
}));
|
||||
|
||||
req.get = sinon.stub().withArgs('origin').returns(origin);
|
||||
|
@ -47,7 +47,7 @@ describe('normalize', function () {
|
||||
it('should not do manipulation without resize flag set', function (done) {
|
||||
configUtils.set({
|
||||
imageOptimization: {
|
||||
resize: false,
|
||||
resize: false
|
||||
}
|
||||
});
|
||||
|
||||
@ -60,7 +60,7 @@ describe('normalize', function () {
|
||||
it('should not create files array when processing fails', function (done) {
|
||||
image.manipulator.process.rejects();
|
||||
|
||||
normalize(req, res, ()=> {
|
||||
normalize(req, res, () => {
|
||||
common.logging.error.calledOnce.should.be.true();
|
||||
req.file.should.not.be.equal(undefined);
|
||||
should.not.exist(req.files);
|
||||
|
@ -891,7 +891,7 @@ DataGenerator.forKnex = (function () {
|
||||
const api_keys = [
|
||||
createBasic(DataGenerator.Content.api_keys[0]),
|
||||
createBasic(DataGenerator.Content.api_keys[1]),
|
||||
createBasic(DataGenerator.Content.api_keys[2]),
|
||||
createBasic(DataGenerator.Content.api_keys[2])
|
||||
];
|
||||
|
||||
return {
|
||||
|
@ -500,7 +500,7 @@ fixtures = {
|
||||
return Promise.map(DataGenerator.forKnex.api_keys, function (api_key) {
|
||||
return models.ApiKey.add(api_key, module.exports.context.internal);
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
/** Test Utility Functions **/
|
||||
@ -1132,7 +1132,7 @@ module.exports = {
|
||||
urlService.resetGenerators();
|
||||
urlService.resources.reset({ignoreDBReady: true});
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
teardown: teardown,
|
||||
truncate: truncate,
|
||||
@ -1200,7 +1200,7 @@ module.exports = {
|
||||
admin: {user: {roles: [DataGenerator.Content.roles[0]]}},
|
||||
editor: {user: {roles: [DataGenerator.Content.roles[1]]}},
|
||||
author: {user: {roles: [DataGenerator.Content.roles[2]]}},
|
||||
contributor: {user: {roles: [DataGenerator.Content.roles[4]]}},
|
||||
contributor: {user: {roles: [DataGenerator.Content.roles[4]]}}
|
||||
},
|
||||
users: {
|
||||
ids: {
|
||||
|
@ -129,7 +129,7 @@
|
||||
"sqlite3": "4.0.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "5.12.1",
|
||||
"eslint": "6.0.1",
|
||||
"eslint-plugin-ghost": "0.1.0",
|
||||
"grunt": "1.0.4",
|
||||
"grunt-bg-shell": "2.3.3",
|
||||
@ -147,7 +147,7 @@
|
||||
"grunt-subgrunt": "1.3.0",
|
||||
"grunt-update-submodules": "0.4.1",
|
||||
"matchdep": "2.0.0",
|
||||
"mocha": "5.2.0",
|
||||
"mocha": "6.1.4",
|
||||
"mock-knex": "0.4.5",
|
||||
"nock": "10.0.6",
|
||||
"proxyquire": "2.1.0",
|
||||
@ -155,7 +155,7 @@
|
||||
"should": "13.2.3",
|
||||
"should-http": "0.1.1",
|
||||
"sinon": "7.2.3",
|
||||
"supertest": "3.4.1",
|
||||
"supertest": "4.0.2",
|
||||
"tmp": "0.0.33"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user