mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-27 12:53:13 +03:00
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:
parent
33e2b39295
commit
431f0ed842
@ -1145,26 +1145,15 @@ Object {
|
|||||||
"type": "automatic",
|
"type": "automatic",
|
||||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
"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 {
|
"meta": Object {
|
||||||
"pagination": Object {
|
"pagination": Object {
|
||||||
"limit": 3,
|
"limit": 2,
|
||||||
"next": null,
|
"next": null,
|
||||||
"page": 1,
|
"page": 1,
|
||||||
"pages": 1,
|
"pages": 1,
|
||||||
"prev": null,
|
"prev": null,
|
||||||
"total": 3,
|
"total": 2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -1174,7 +1163,7 @@ exports[`Collections API Browse Can browse Collections 2: [headers] 1`] = `
|
|||||||
Object {
|
Object {
|
||||||
"access-control-allow-origin": "http://127.0.0.1:2369",
|
"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",
|
"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-type": "application/json; charset=utf-8",
|
||||||
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
|
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
|
||||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||||
|
@ -66,7 +66,7 @@ describe('Collections API', function () {
|
|||||||
description: 'Test Collection Description'
|
description: 'Test Collection Description'
|
||||||
};
|
};
|
||||||
|
|
||||||
await agent
|
const {body: {collections: [{id: collectionId}]}} = await agent
|
||||||
.post('/collections/')
|
.post('/collections/')
|
||||||
.body({
|
.body({
|
||||||
collections: [collection]
|
collections: [collection]
|
||||||
@ -80,6 +80,10 @@ describe('Collections API', function () {
|
|||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
collections: [matchCollection]
|
collections: [matchCollection]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await agent
|
||||||
|
.delete(`/collections/${collectionId}/`)
|
||||||
|
.expectStatus(204);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Browse', function () {
|
describe('Browse', function () {
|
||||||
@ -93,7 +97,6 @@ describe('Collections API', function () {
|
|||||||
})
|
})
|
||||||
.matchBodySnapshot({
|
.matchBodySnapshot({
|
||||||
collections: [
|
collections: [
|
||||||
matchCollection,
|
|
||||||
matchCollection,
|
matchCollection,
|
||||||
matchCollection
|
matchCollection
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user