Ghost/ghost/core/test/e2e-api/admin/mentions.test.js
Daniel Lockyer 89493893d1 Removed all unused variables from test files
- this cleans up all imports or variables that aren't currently being used
- this really helps keep the tests clean by only allowing what is needed
- I've left `should` as an exemption for now because we need to clean up
  how it is used
2023-03-10 14:29:55 +01:00

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 () {
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');
await agent.get('mentions/')
.expectStatus(404);
});
});