2023-01-30 16:59:00 +03:00
|
|
|
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 () {
|
2023-03-10 14:53:35 +03:00
|
|
|
await agent.get('mentions/?limit=2')
|
2023-01-30 16:59:00 +03:00
|
|
|
.expectStatus(200)
|
|
|
|
.matchBodySnapshot({
|
|
|
|
mentions: new Array(2).fill(matchMentionShallowIncludes)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|