mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
e9d6f61029
refs: https://github.com/TryGhost/Ghost/commit/11867ab43
- These checks live in the wrong place. They are mostly a frontend thing
- The only server place they were used was slack and that was fixed in 11867ab43
- Moving these to the frontend they fit neatly into the frontend data service
43 lines
1.8 KiB
JavaScript
43 lines
1.8 KiB
JavaScript
const should = require('should');
|
|
const {checks} = require('../../../../../core/frontend/services/data');
|
|
|
|
describe('Checks', function () {
|
|
it('methods', function () {
|
|
Object.keys(checks).should.eql([
|
|
'isPost',
|
|
'isTag',
|
|
'isUser',
|
|
'isNav'
|
|
]);
|
|
});
|
|
it('isPost', function () {
|
|
checks.isPost({}).should.eql(false);
|
|
checks.isPost({title: 'Test'}).should.eql(false);
|
|
checks.isPost({title: 'Test', slug: 'test'}).should.eql(false);
|
|
checks.isPost({title: 'Test', slug: 'test', html: ''}).should.eql(true);
|
|
});
|
|
|
|
it('isTag', function () {
|
|
checks.isTag({}).should.eql(false);
|
|
checks.isTag({name: 'Test'}).should.eql(false);
|
|
checks.isTag({name: 'Test', slug: 'test'}).should.eql(false);
|
|
checks.isTag({name: 'Test', slug: 'test', description: ''}).should.eql(false);
|
|
checks.isTag({name: 'Test', slug: 'test', description: '', feature_image: ''}).should.eql(true);
|
|
});
|
|
|
|
it('isUser', function () {
|
|
checks.isUser({}).should.eql(false);
|
|
checks.isUser({bio: 'Test'}).should.eql(false);
|
|
checks.isUser({bio: 'Test', website: 'test'}).should.eql(false);
|
|
checks.isUser({bio: 'Test', website: 'test', profile_image: ''}).should.eql(false);
|
|
checks.isUser({bio: 'Test', website: 'test', profile_image: '', location: ''}).should.eql(true);
|
|
});
|
|
|
|
it('isNav', function () {
|
|
checks.isNav({}).should.eql(false);
|
|
checks.isNav({label: 'Test'}).should.eql(false);
|
|
checks.isNav({label: 'Test', slug: 'test'}).should.eql(false);
|
|
checks.isNav({label: 'Test', slug: 'test', url: ''}).should.eql(false);
|
|
checks.isNav({label: 'Test', slug: 'test', url: '', current: false}).should.eql(true);
|
|
});
|
|
});
|