Fixed the "Can add a Collection" test

The test was addign an extra collection, but not cleaning it up - which makes it
hard to reason about other tests, especially when running them in isolation and
the state is different. This just cleans up the test and updates the browse test
to match the right snapshot.
This commit is contained in:
Fabien "egg" O'Carroll 2023-07-25 16:40:48 +02:00 committed by Fabien 'egg' O'Carroll
parent 33e2b39295
commit 431f0ed842
2 changed files with 8 additions and 16 deletions

View File

@ -1145,26 +1145,15 @@ Object {
"type": "automatic",
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
},
Object {
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
"description": "Test Collection Description",
"feature_image": null,
"filter": null,
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"slug": "test-collection",
"title": "Test Collection",
"type": "manual",
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
},
],
"meta": Object {
"pagination": Object {
"limit": 3,
"limit": 2,
"next": null,
"page": 1,
"pages": 1,
"prev": null,
"total": 3,
"total": 2,
},
},
}
@ -1174,7 +1163,7 @@ exports[`Collections API Browse Can browse Collections 2: [headers] 1`] = `
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "838",
"content-length": "578",
"content-type": "application/json; charset=utf-8",
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,

View File

@ -66,7 +66,7 @@ describe('Collections API', function () {
description: 'Test Collection Description'
};
await agent
const {body: {collections: [{id: collectionId}]}} = await agent
.post('/collections/')
.body({
collections: [collection]
@ -80,6 +80,10 @@ describe('Collections API', function () {
.matchBodySnapshot({
collections: [matchCollection]
});
await agent
.delete(`/collections/${collectionId}/`)
.expectStatus(204);
});
describe('Browse', function () {
@ -93,7 +97,6 @@ describe('Collections API', function () {
})
.matchBodySnapshot({
collections: [
matchCollection,
matchCollection,
matchCollection
]