mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-15 03:01:37 -05:00
Fixed snapshot tests using version headers
refs3381dae1e6
refs4a4b0cc8a6
refsf432ee9aa6
- The initial tests didn't take into account the veersion of the Ghost instance would be changing contantly. The "context" part of the returned version missmatch errors should be a regex with only partially hardcoded message.
This commit is contained in:
parent
f432ee9aa6
commit
d9ac05f97a
2 changed files with 6 additions and 6 deletions
|
@ -88,7 +88,7 @@ Object {
|
|||
"errors": Array [
|
||||
Object {
|
||||
"code": null,
|
||||
"context": "Provided client version v999.1 is ahead of current Ghost instance version v4.43.",
|
||||
"context": StringMatching /Provided client version v999\\\\\\.1 is ahead of current Ghost instance version v\\\\d\\+\\\\\\.\\\\d\\+/,
|
||||
"details": null,
|
||||
"help": "Upgrade your Ghost instance.",
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{8\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{12\\}/,
|
||||
|
@ -117,7 +117,7 @@ Object {
|
|||
"errors": Array [
|
||||
Object {
|
||||
"code": null,
|
||||
"context": "Provided client version v3.1 is outdated and is behind current Ghost version v4.43.",
|
||||
"context": StringMatching /Provided client version v3\\.1 is outdated and is behind current Ghost version v\\\\d\\+\\\\\\.\\\\d\\+/,
|
||||
"details": null,
|
||||
"help": "Upgrade your Ghost API client.",
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{8\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{12\\}/,
|
||||
|
|
|
@ -54,8 +54,7 @@ describe('API Versioning', function () {
|
|||
});
|
||||
});
|
||||
|
||||
// eslint-disable-next-line ghost/mocha/no-skipped-tests
|
||||
it.skip('responds with error requested version is AHEAD and CANNOT respond', async function () {
|
||||
it('responds with error requested version is AHEAD and CANNOT respond', async function () {
|
||||
// CASE 2: If accept-version is behind, send a 406 & tell them the client needs updating.
|
||||
await agentAdminAPI
|
||||
.get('removed_endpoint')
|
||||
|
@ -65,13 +64,13 @@ describe('API Versioning', function () {
|
|||
})
|
||||
.matchBodySnapshot({
|
||||
errors: [{
|
||||
context: stringMatching(/Provided client version v999\.1 is ahead of current Ghost instance version v\d+\.\d+/),
|
||||
id: anyErrorId
|
||||
}]
|
||||
});
|
||||
});
|
||||
|
||||
// eslint-disable-next-line ghost/mocha/no-skipped-tests
|
||||
it.skip('responds with error when requested version is BEHIND and CANNOT respond', async function () {
|
||||
it('responds with error when requested version is BEHIND and CANNOT respond', async function () {
|
||||
// CASE 2: If accept-version is behind, send a 406 & tell them the client needs updating.
|
||||
await agentAdminAPI
|
||||
.get('removed_endpoint')
|
||||
|
@ -81,6 +80,7 @@ describe('API Versioning', function () {
|
|||
})
|
||||
.matchBodySnapshot({
|
||||
errors: [{
|
||||
context: stringMatching(/Provided client version v3.1 is outdated and is behind current Ghost version v\d+\.\d+/),
|
||||
id: anyErrorId
|
||||
}]
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue