0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Finished refactor of content utils in acceptance suite

refs 06dd9bac59

- This is a continuation of the work started in the refed commit. In short: allowlisting response checks wherever possible
- The file is now "schema" depencency free. Should serve as an example for other test "utils" modules.
This commit is contained in:
Naz 2021-05-13 16:19:33 +04:00
parent 255b4da7a2
commit d698a2b431

View file

@ -1,7 +1,7 @@
const url = require('url'); const url = require('url');
const _ = require('lodash'); const _ = require('lodash');
const testUtils = require('../../utils'); const testUtils = require('../../utils');
const schema = require('../../../core/server/data/schema').tables;
const API_URL = '/ghost/api/canary/content/'; const API_URL = '/ghost/api/canary/content/';
const expectedProperties = { const expectedProperties = {
@ -45,27 +45,40 @@ const expectedProperties = {
'frontmatter', 'frontmatter',
'reading_time' 'reading_time'
], ],
author: _(schema.users) author: [
.keys() 'id',
.without( 'name',
'password', 'slug',
'email', 'profile_image',
'created_at', 'cover_image',
'created_by', 'bio',
'updated_at', 'website',
'updated_by', 'location',
'last_seen', 'facebook',
'status' 'twitter',
) 'meta_title',
// v2 API doesn't return unused fields 'meta_description'
.without('accessibility', 'locale', 'tour', 'visibility') ],
, tag: [
tag: _(schema.tags) 'id',
.keys() 'name',
// v2 Tag API doesn't return parent_id or parent 'slug',
.without('parent_id', 'parent') 'description',
// v2 Tag API doesn't return date fields 'feature_image',
.without('created_at', 'updated_at') 'visibility',
'og_image',
'og_title',
'og_description',
'twitter_image',
'twitter_title',
'twitter_description',
'meta_title',
'meta_description',
'codeinjection_head',
'codeinjection_foot',
'canonical_url',
'accent_color'
]
}; };
_.each(expectedProperties, (value, key) => { _.each(expectedProperties, (value, key) => {