0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-15 03:01:37 -05:00

Added staus code assertions to version test suite

refs https://github.com/TryGhost/Toolbox/issues/280

- All e2e tests should be checking returned status code! This was missed when writing tests
This commit is contained in:
Naz 2022-04-21 12:45:21 +08:00
parent 065078c397
commit f28e65b4e7

View file

@ -14,6 +14,7 @@ describe('API Versioning', function () {
it('responds with no content version header when accept version header is NOT PRESENT', async function () {
await agentAdminAPI
.get('site/')
.expectStatus(200)
.matchBodySnapshot({
site: {
version: stringMatching(/\d+\.\d+/)
@ -28,6 +29,7 @@ describe('API Versioning', function () {
await agentAdminAPI
.get('site/')
.header('Accept-Version', 'v3.0')
.expectStatus(200)
.matchBodySnapshot({
site: {
version: stringMatching(/\d+\.\d+/)
@ -43,6 +45,7 @@ describe('API Versioning', function () {
await agentAdminAPI
.get('site/')
.header('Accept-Version', 'v999.5')
.expectStatus(200)
.matchBodySnapshot({
site: {
version: stringMatching(/\d+\.\d+/)
@ -59,6 +62,7 @@ describe('API Versioning', function () {
await agentAdminAPI
.get('removed_endpoint')
.header('Accept-Version', 'v999.1')
.expectStatus(406)
.matchHeaderSnapshot({
etag: anyString
})
@ -75,6 +79,7 @@ describe('API Versioning', function () {
await agentAdminAPI
.get('removed_endpoint')
.header('Accept-Version', 'v3.1')
.expectStatus(406)
.matchHeaderSnapshot({
etag: anyString
})
@ -90,6 +95,7 @@ describe('API Versioning', function () {
await agentAdminAPI
.get('/members/member_does_not_exist@example.com')
.header('Accept-Version', 'v4.1')
.expectStatus(404)
.matchHeaderSnapshot({
etag: anyString
})