Ghost/ghost/core/test/e2e-api/members/announcement.test.js
Naz 06c0a19718 Moved announcement bar settings to Frontend Members API
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
2023-04-27 14:01:36 +02:00

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();
});
});