mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
477295a262
refs TryGhost/Team#2468 -added simple browse api tests for webmentions -need to add user access tests and possibly site access (private sites)
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
const {agentProvider, fixtureManager, mockManager, matchers} = require('../../utils/e2e-framework');
|
|
const {anyObjectId, anyISODateTime, anyString} = matchers;
|
|
|
|
const matchMentionShallowIncludes = {
|
|
id: anyObjectId,
|
|
source: anyString,
|
|
target: anyString,
|
|
timestamp: anyISODateTime,
|
|
source_title: anyString
|
|
};
|
|
|
|
describe('Mentions API', function () {
|
|
let agent;
|
|
|
|
before(async function () {
|
|
agent = await agentProvider.getAdminAPIAgent();
|
|
mockManager.mockLabsEnabled('webmentions');
|
|
// TODO: test various users' access
|
|
await fixtureManager.init('users','mentions');
|
|
await agent.loginAsOwner();
|
|
});
|
|
|
|
afterEach(function () {
|
|
mockManager.restore();
|
|
});
|
|
|
|
it('Can browse with limits', async function () {
|
|
const res = await agent.get('mentions/?limit=2')
|
|
.expectStatus(200)
|
|
.matchBodySnapshot({
|
|
mentions: new Array(2).fill(matchMentionShallowIncludes)
|
|
});
|
|
});
|
|
|
|
it('Cannot browse when lab disabled', async function () {
|
|
mockManager.mockLabsDisabled('webmentions');
|
|
const res = await agent.get('mentions/')
|
|
.expectStatus(404);
|
|
});
|
|
});
|