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

Fixed snapshots for post stats export e2e-api test

The Content-Disposition header was not matching because we use the date in the
filename for the exported CSV file. I haven't created a new matcher here because
it's quite unique, and we don't want an `anyContentDisposition` matcher because
the filename is a part of the API.
This commit is contained in:
Fabien "egg" O'Carroll 2023-03-28 09:48:17 +07:00
parent 7928b53fbd
commit 349f3b01eb
2 changed files with 12 additions and 8 deletions

View file

@ -878,7 +878,7 @@ exports[`Posts API Export Can export 1: [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-disposition": "Attachment; filename=\\"posts.2023-03-27.csv\\"",
"content-disposition": StringMatching /\\^Attachment; filename="posts\\.\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}\\.csv"\\$/,
"content-length": "2511",
"content-type": "text/csv; charset=utf-8",
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
@ -909,7 +909,7 @@ exports[`Posts API Export Can export with filter 1: [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-disposition": "Attachment; filename=\\"posts.2023-03-27.csv\\"",
"content-disposition": StringMatching /\\^Attachment; filename="posts\\.\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}\\.csv"\\$/,
"content-length": "544",
"content-type": "text/csv; charset=utf-8",
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
@ -931,7 +931,7 @@ exports[`Posts API Export Can export with limit 1: [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-disposition": "Attachment; filename=\\"posts.2023-03-27.csv\\"",
"content-disposition": StringMatching /\\^Attachment; filename="posts\\.\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}\\.csv"\\$/,
"content-length": "381",
"content-type": "text/csv; charset=utf-8",
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
@ -952,7 +952,7 @@ exports[`Posts API Export Can export with order 1: [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-disposition": "Attachment; filename=\\"posts.2023-03-27.csv\\"",
"content-disposition": StringMatching /\\^Attachment; filename="posts\\.\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}\\.csv"\\$/,
"content-length": "2511",
"content-type": "text/csv; charset=utf-8",
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,

View file

@ -126,7 +126,8 @@ describe('Posts API', function () {
.expectStatus(200)
.matchHeaderSnapshot({
'content-version': anyContentVersion,
etag: anyEtag
etag: anyEtag,
'content-disposition': stringMatching(/^Attachment; filename="posts.\d{4}-\d{2}-\d{2}.csv"$/)
});
// body snapshot doesn't work with text/csv
@ -143,7 +144,8 @@ describe('Posts API', function () {
.expectStatus(200)
.matchHeaderSnapshot({
'content-version': anyContentVersion,
etag: anyEtag
etag: anyEtag,
'content-disposition': stringMatching(/^Attachment; filename="posts.\d{4}-\d{2}-\d{2}.csv"$/)
});
// body snapshot doesn't work with text/csv
@ -160,7 +162,8 @@ describe('Posts API', function () {
.expectStatus(200)
.matchHeaderSnapshot({
'content-version': anyContentVersion,
etag: anyEtag
etag: anyEtag,
'content-disposition': stringMatching(/^Attachment; filename="posts.\d{4}-\d{2}-\d{2}.csv"$/)
});
// body snapshot doesn't work with text/csv
@ -177,7 +180,8 @@ describe('Posts API', function () {
.expectStatus(200)
.matchHeaderSnapshot({
'content-version': anyContentVersion,
etag: anyEtag
etag: anyEtag,
'content-disposition': stringMatching(/^Attachment; filename="posts.\d{4}-\d{2}-\d{2}.csv"$/)
});
// body snapshot doesn't work with text/csv