mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Fixed invalid query strings in tests
closes https://github.com/TryGhost/Team/issues/2324 - It seemed like the "limit" query parameter did not work properly returning multiple entries from the endpoint. In reality the whole query string was ignored because of an error in the "filter" part of the query ^_^
This commit is contained in:
parent
65d910f43b
commit
80decf8303
2 changed files with 15 additions and 27 deletions
|
@ -52,29 +52,15 @@ exports[`Tiers API Can edit tier properties and relations 1: [body] 1`] = `
|
|||
Object {
|
||||
"meta": Object {
|
||||
"pagination": Object {
|
||||
"limit": 2,
|
||||
"limit": 1,
|
||||
"next": null,
|
||||
"page": 1,
|
||||
"pages": 1,
|
||||
"prev": null,
|
||||
"total": 2,
|
||||
"total": 1,
|
||||
},
|
||||
},
|
||||
"tiers": Array [
|
||||
Object {
|
||||
"active": true,
|
||||
"benefits": Array [],
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"description": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"name": "Free",
|
||||
"slug": "free",
|
||||
"trial_days": 0,
|
||||
"type": "free",
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"visibility": "none",
|
||||
"welcome_page_url": "/welcome-free",
|
||||
},
|
||||
Object {
|
||||
"active": true,
|
||||
"benefits": Array [],
|
||||
|
@ -88,7 +74,7 @@ Object {
|
|||
"trial_days": 0,
|
||||
"type": "paid",
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"visibility": "public",
|
||||
"visibility": "none",
|
||||
"welcome_page_url": "/welcome-paid",
|
||||
"yearly_price": 5000,
|
||||
},
|
||||
|
@ -100,7 +86,7 @@ exports[`Tiers API Can edit tier properties and relations 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": "725",
|
||||
"content-length": "450",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Accept-Version, Origin, Accept-Encoding",
|
||||
|
@ -118,15 +104,18 @@ Object {
|
|||
"delicious avo toast",
|
||||
],
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"currency": "USD",
|
||||
"description": "Updated description",
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"name": "Free",
|
||||
"slug": "free",
|
||||
"monthly_price": 500,
|
||||
"name": "Default Product",
|
||||
"slug": "default-product",
|
||||
"trial_days": 0,
|
||||
"type": "free",
|
||||
"type": "paid",
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"visibility": "none",
|
||||
"welcome_page_url": "/welcome-free",
|
||||
"welcome_page_url": "/welcome-paid",
|
||||
"yearly_price": 5000,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
@ -136,7 +125,7 @@ exports[`Tiers API Can edit tier properties and relations 4: [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": "343",
|
||||
"content-length": "422",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Accept-Version, Origin, Accept-Encoding",
|
||||
|
|
|
@ -95,7 +95,7 @@ describe('Tiers API', function () {
|
|||
});
|
||||
|
||||
it('Can edit visibility', async function () {
|
||||
const {body: {tiers: [tier]}} = await agent.get('/tiers/?type:paid&limit=1');
|
||||
const {body: {tiers: [tier]}} = await agent.get('/tiers/?filter=type:paid&limit=1');
|
||||
|
||||
const visibility = tier.visibility === 'none' ? 'public' : 'none';
|
||||
|
||||
|
@ -129,14 +129,13 @@ describe('Tiers API', function () {
|
|||
});
|
||||
|
||||
it('Can edit tier properties and relations', async function () {
|
||||
let {body: {tiers: [tier]}} = await agent.get('/tiers/?type:paid&limit=1')
|
||||
let {body: {tiers: [tier]}} = await agent.get('/tiers/?filter=type:paid&limit=1')
|
||||
.expectStatus(200)
|
||||
.matchHeaderSnapshot({
|
||||
etag: anyEtag
|
||||
})
|
||||
.matchBodySnapshot({
|
||||
// @NOTE: bug here, the returned array of tiers should be '1' NOT '2'
|
||||
tiers: Array(2).fill({
|
||||
tiers: Array(1).fill({
|
||||
id: matchers.anyObjectId,
|
||||
created_at: matchers.anyISODateTime,
|
||||
updated_at: matchers.anyISODateTime
|
||||
|
|
Loading…
Add table
Reference in a new issue