mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
Added a test for Public member data endpoint
refs https://github.com/TryGhost/Arch/issues/87 - There was no test whatsoever! Adding a super basic test to have some certainty the output doesn't change after a refactor
This commit is contained in:
parent
e73b16979f
commit
a284e8275d
1 changed files with 38 additions and 0 deletions
|
@ -488,6 +488,44 @@ describe('Front-end members behavior', function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('can fetch member data', async function () {
|
||||||
|
const res = await request.get('/members/api/member')
|
||||||
|
.expect(200);
|
||||||
|
|
||||||
|
const memberData = res.body;
|
||||||
|
should.exist(memberData);
|
||||||
|
|
||||||
|
// @NOTE: this should be a snapshot test not code
|
||||||
|
memberData.should.have.properties([
|
||||||
|
'uuid',
|
||||||
|
'email',
|
||||||
|
'name',
|
||||||
|
'firstname',
|
||||||
|
'expertise',
|
||||||
|
'avatar_image',
|
||||||
|
'subscribed',
|
||||||
|
'subscriptions',
|
||||||
|
'paid',
|
||||||
|
'created_at',
|
||||||
|
'enable_comment_notifications',
|
||||||
|
'newsletters',
|
||||||
|
'email_suppression'
|
||||||
|
]);
|
||||||
|
Object.keys(memberData).should.have.length(13);
|
||||||
|
memberData.should.not.have.property('id');
|
||||||
|
memberData.newsletters.should.have.length(1);
|
||||||
|
|
||||||
|
// @NOTE: this should be a snapshot test not code
|
||||||
|
Object.keys(memberData.newsletters[0]).should.have.length(5);
|
||||||
|
memberData.newsletters[0].should.have.properties([
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'description',
|
||||||
|
'status',
|
||||||
|
'sort_order'
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
it('can read public post content', async function () {
|
it('can read public post content', async function () {
|
||||||
await request
|
await request
|
||||||
.get('/free-to-see/')
|
.get('/free-to-see/')
|
||||||
|
|
Loading…
Add table
Reference in a new issue