mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 00:11:49 +03:00
64b472166c
fixes https://github.com/TryGhost/Product/issues/3830 This endpoint is required for recommendations to work: admin-x loads the incoming recommendations by querying the mentions endpoint. If the mentions flag was not enabled, this endpoint wasn't available.
34 lines
946 B
JavaScript
34 lines
946 B
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();
|
|
// TODO: test various users' access
|
|
await fixtureManager.init('users','mentions');
|
|
await agent.loginAsOwner();
|
|
});
|
|
|
|
afterEach(function () {
|
|
mockManager.restore();
|
|
});
|
|
|
|
it('Can browse with limits', async function () {
|
|
await agent.get('mentions/?limit=2')
|
|
.expectStatus(200)
|
|
.matchBodySnapshot({
|
|
mentions: new Array(2).fill(matchMentionShallowIncludes)
|
|
});
|
|
});
|
|
});
|