mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-20 17:32:15 +03:00
517c406e17
The only usecases we need to support at the moment are reading individual collections by ID and by Slug. We can extend this API as we get more usescases in future.
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
const {agentProvider, fixtureManager, matchers} = require('../../utils/e2e-framework');
|
|
const {anyISODateTime, anyObjectId} = matchers;
|
|
|
|
const collectionMatcher = {
|
|
id: anyObjectId,
|
|
created_at: anyISODateTime,
|
|
updated_at: anyISODateTime
|
|
};
|
|
|
|
describe('Collections Content API', function () {
|
|
let agent;
|
|
|
|
before(async function () {
|
|
agent = await agentProvider.getContentAPIAgent();
|
|
await fixtureManager.init('users', 'api_keys');
|
|
await agent.authenticate();
|
|
});
|
|
|
|
it('Can request a collection by slug and id', async function () {
|
|
const {body: {collections: [collection]}} = await agent
|
|
.get(`collections/slug/featured`)
|
|
.expectStatus(200)
|
|
.matchBodySnapshot({
|
|
collections: [collectionMatcher]
|
|
});
|
|
|
|
await agent
|
|
.get(`collections/${collection.id}`)
|
|
.expectStatus(200)
|
|
.matchBodySnapshot({
|
|
collections: [collectionMatcher]
|
|
});
|
|
});
|
|
});
|