mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00: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:
parent
255b4da7a2
commit
d698a2b431
1 changed files with 35 additions and 22 deletions
|
@ -1,7 +1,7 @@
|
|||
const url = require('url');
|
||||
const _ = require('lodash');
|
||||
const testUtils = require('../../utils');
|
||||
const schema = require('../../../core/server/data/schema').tables;
|
||||
|
||||
const API_URL = '/ghost/api/canary/content/';
|
||||
|
||||
const expectedProperties = {
|
||||
|
@ -45,27 +45,40 @@ const expectedProperties = {
|
|||
'frontmatter',
|
||||
'reading_time'
|
||||
],
|
||||
author: _(schema.users)
|
||||
.keys()
|
||||
.without(
|
||||
'password',
|
||||
'email',
|
||||
'created_at',
|
||||
'created_by',
|
||||
'updated_at',
|
||||
'updated_by',
|
||||
'last_seen',
|
||||
'status'
|
||||
)
|
||||
// v2 API doesn't return unused fields
|
||||
.without('accessibility', 'locale', 'tour', 'visibility')
|
||||
,
|
||||
tag: _(schema.tags)
|
||||
.keys()
|
||||
// v2 Tag API doesn't return parent_id or parent
|
||||
.without('parent_id', 'parent')
|
||||
// v2 Tag API doesn't return date fields
|
||||
.without('created_at', 'updated_at')
|
||||
author: [
|
||||
'id',
|
||||
'name',
|
||||
'slug',
|
||||
'profile_image',
|
||||
'cover_image',
|
||||
'bio',
|
||||
'website',
|
||||
'location',
|
||||
'facebook',
|
||||
'twitter',
|
||||
'meta_title',
|
||||
'meta_description'
|
||||
],
|
||||
tag: [
|
||||
'id',
|
||||
'name',
|
||||
'slug',
|
||||
'description',
|
||||
'feature_image',
|
||||
'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) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue