mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 03:14:03 +03:00
06c0a19718
https://github.com/TryGhost/Team/issues/3121 - Because the announcement data has to be available with member's context, it's only possible to have it in cross-origin requests in the Members API. - Exposed the announcement bar data through `GET /members/api/announcement` endpoint
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
const {agentProvider, mockManager, fixtureManager, matchers, configUtils} = require('../../utils/e2e-framework');
|
|
const {anyEtag} = matchers;
|
|
const settingsCache = require('../../../core/shared/settings-cache');
|
|
|
|
describe('Announcement', function () {
|
|
let membersAgent;
|
|
|
|
before(async function () {
|
|
membersAgent = await agentProvider.getMembersAPIAgent();
|
|
|
|
await fixtureManager.init('members');
|
|
});
|
|
|
|
afterEach(async function () {
|
|
await configUtils.restore();
|
|
mockManager.restore();
|
|
});
|
|
|
|
it('Can read announcement endpoint', async function () {
|
|
await membersAgent
|
|
.get(`/api/announcement/`)
|
|
.expectStatus(200)
|
|
.matchHeaderSnapshot({
|
|
etag: anyEtag
|
|
})
|
|
.matchBodySnapshot();
|
|
});
|
|
|
|
it('Can read announcement when it is present in announcement data', async function () {
|
|
settingsCache.set('announcement_content', {value: '<p>Test announcement</p>'});
|
|
settingsCache.set('announcement_visibility', {value: ['visitors']});
|
|
|
|
await membersAgent
|
|
.get(`/api/announcement/`)
|
|
.expectStatus(200)
|
|
.matchHeaderSnapshot({
|
|
etag: anyEtag
|
|
})
|
|
.matchBodySnapshot();
|
|
});
|
|
});
|