mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
Switched new e2e-framework to use our own snapshot lib (#14137)
refs TryGhost/Toolbox#158 refs TryGhost/Toolbox#129 (comment) We now have @tryghost/jest-snapshot - a suite of utilities for using snapshots with mocha, should, etc The @tryghost/express-test lib also uses it to provide chained snapshot assertions This library was created because all the existing implementations I could find, including the in use @ethanresnick/chai-jest-snapshot didn't properly support property matching. @ethanresnick/chai-jest-snapshot supposedly supported it, but the implementation was incorrect and frequently lead to false test passes. This library also has (after some back and forth) path resolution so that snapshots can live in a local __snapshots__ folder
This commit is contained in:
parent
0822a5b7a1
commit
069c344495
@ -26,13 +26,13 @@
|
||||
"setup": "yarn install && knex-migrator init && grunt symlink && grunt init || (exit 0)",
|
||||
"main": "grunt shell:main && grunt subgrunt:init",
|
||||
"build": "grunt build",
|
||||
"test": "mocha --require=./test/utils/overrides.js --require=./test/utils/snapshots.js --exit --trace-warnings --recursive --extension=test.js --timeout=60000",
|
||||
"test": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js --timeout=60000",
|
||||
"test:all": "yarn test:unit && yarn test:integration && yarn test:e2e && yarn lint",
|
||||
"test:debug": "DEBUG=ghost:test* yarn test",
|
||||
"test:unit": "c8 --reporter text-summary --reporter cobertura mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/unit' --timeout=2000",
|
||||
"test:integration": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/integration' --timeout=5000",
|
||||
"test:e2e": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/e2e-api' './test/e2e-frontend' './test/e2e-server' --timeout=10000",
|
||||
"test:regression": "mocha --require=./test/utils/overrides.js --require=./test/utils/snapshots.js --exit --trace-warnings --recursive --extension=test.js './test/regression' --timeout=60000",
|
||||
"test:regression": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/regression' --timeout=60000",
|
||||
"test:unit:slow": "yarn test:unit --reporter=mocha-slow-test-reporter",
|
||||
"test:int:slow": "yarn test:integration --reporter=mocha-slow-test-reporter",
|
||||
"test:e2e:slow": "yarn test:e2e --reporter=mocha-slow-test-reporter",
|
||||
@ -181,16 +181,15 @@
|
||||
"sqlite3": "5.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ethanresnick/chai-jest-snapshot": "3.0.0",
|
||||
"@lodder/grunt-postcss": "3.1.1",
|
||||
"@tryghost/express-test": "0.2.0",
|
||||
"@tryghost/express-test": "0.4.1",
|
||||
"@tryghost/jest-snapshot": "0.3.1",
|
||||
"c8": "7.11.0",
|
||||
"chai": "4.3.6",
|
||||
"coffeescript": "2.6.1",
|
||||
"cssnano": "5.0.17",
|
||||
"eslint": "8.8.0",
|
||||
"eslint-plugin-ghost": "2.12.0",
|
||||
"expect": "27.5.0",
|
||||
"grunt": "1.4.1",
|
||||
"grunt-bg-shell": "2.3.3",
|
||||
"grunt-contrib-clean": "2.0.0",
|
||||
|
@ -0,0 +1,422 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Authentication API Blog setup complete setup 1: [body] 1`] = `
|
||||
Object {
|
||||
"users": Array [
|
||||
Object {
|
||||
"accessibility": null,
|
||||
"bio": null,
|
||||
"cover_image": null,
|
||||
"created_at": Any<String>,
|
||||
"email": "test@example.com",
|
||||
"facebook": null,
|
||||
"id": "1",
|
||||
"last_seen": null,
|
||||
"location": null,
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "test user",
|
||||
"profile_image": null,
|
||||
"slug": "test",
|
||||
"status": "active",
|
||||
"tour": null,
|
||||
"twitter": null,
|
||||
"updated_at": Any<String>,
|
||||
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
|
||||
"website": null,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Blog setup complete setup 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": "434",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-cache-invalidate": "/*",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Blog setup complete setup again 1: [body] 1`] = `
|
||||
Object {
|
||||
"errors": Array [
|
||||
Object {
|
||||
"code": null,
|
||||
"context": null,
|
||||
"details": null,
|
||||
"help": null,
|
||||
"id": Any<String>,
|
||||
"message": "Setup has already been completed.",
|
||||
"property": null,
|
||||
"type": "NoPermissionError",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Blog setup complete setup again 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": "201",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Blog setup is setup? no 1: [body] 1`] = `
|
||||
Object {
|
||||
"setup": Array [
|
||||
Object {
|
||||
"status": false,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Blog setup is setup? no 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": "28",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Blog setup is setup? yes 1: [body] 1`] = `
|
||||
Object {
|
||||
"setup": Array [
|
||||
Object {
|
||||
"status": true,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Blog setup is setup? yes 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": "27",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Blog setup update setup 1: [body] 1`] = `
|
||||
Object {
|
||||
"users": Array [
|
||||
Object {
|
||||
"accessibility": null,
|
||||
"bio": "bio",
|
||||
"cover_image": null,
|
||||
"created_at": Any<String>,
|
||||
"email": "test-edit@example.com",
|
||||
"facebook": null,
|
||||
"id": "1",
|
||||
"last_seen": Any<String>,
|
||||
"location": "location",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "test user edit",
|
||||
"profile_image": "https://example.com/super_photo.jpg",
|
||||
"slug": "test",
|
||||
"status": "active",
|
||||
"tour": null,
|
||||
"twitter": null,
|
||||
"updated_at": Any<String>,
|
||||
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
|
||||
"website": null,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Blog setup update setup 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": "506",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-cache-invalidate": "/*",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Invitation check invalid invite 1: [body] 1`] = `
|
||||
Object {
|
||||
"invitation": Array [
|
||||
Object {
|
||||
"valid": false,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Invitation check invalid invite 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": "32",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Invitation check invite with invalid email 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-length": "206",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Invitation check valid invite 1: [body] 1`] = `
|
||||
Object {
|
||||
"invitation": Array [
|
||||
Object {
|
||||
"valid": true,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Invitation check valid invite 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": "31",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Invitation try to accept with invite 1: [body] 1`] = `
|
||||
Object {
|
||||
"invitation": Array [
|
||||
Object {
|
||||
"message": "Invitation accepted.",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Invitation try to accept with invite 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": "51",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Invitation try to accept with invite and existing email address 1: [body] 1`] = `
|
||||
Object {
|
||||
"errors": Array [
|
||||
Object {
|
||||
"code": null,
|
||||
"context": "Attempting to create an account with existing email address.",
|
||||
"details": null,
|
||||
"help": "Use different email address to register your account.",
|
||||
"id": Any<String>,
|
||||
"message": "Could not create an account, email is already in use.",
|
||||
"property": null,
|
||||
"type": "ValidationError",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Invitation try to accept with invite and existing email address 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": "328",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Invitation try to accept without invite 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-length": "181",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Password reset reset password 1: [body] 1`] = `
|
||||
Object {
|
||||
"passwordreset": Array [
|
||||
Object {
|
||||
"message": "Password changed successfully.",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Password reset reset password 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": "64",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Password reset reset password: expired token 1: [body] 1`] = `
|
||||
Object {
|
||||
"errors": Array [
|
||||
Object {
|
||||
"code": null,
|
||||
"context": "Password reset link expired.",
|
||||
"details": null,
|
||||
"help": "Request a new password reset via the login form.",
|
||||
"id": Any<String>,
|
||||
"message": "Cannot reset password.",
|
||||
"property": null,
|
||||
"type": "BadRequestError",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Password reset reset password: expired token 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": "260",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Password reset reset password: generate reset token 1: [body] 1`] = `
|
||||
Object {
|
||||
"passwordreset": Array [
|
||||
Object {
|
||||
"message": "Check your email for further instructions.",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Password reset reset password: generate reset token 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": "76",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Password reset reset password: invalid token 1: [body] 1`] = `
|
||||
Object {
|
||||
"errors": Array [
|
||||
Object {
|
||||
"code": null,
|
||||
"context": "Invalid password reset link.",
|
||||
"details": null,
|
||||
"help": "Check if password reset link has been fully copied or request new password reset via the login form.",
|
||||
"id": Any<String>,
|
||||
"message": "Cannot reset password.",
|
||||
"property": null,
|
||||
"type": "UnauthorizedError",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Password reset reset password: invalid token 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": "314",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Password reset reset password: unmatched token 1: [body] 1`] = `
|
||||
Object {
|
||||
"errors": Array [
|
||||
Object {
|
||||
"code": null,
|
||||
"context": "Password reset link has already been used.",
|
||||
"details": null,
|
||||
"help": "Request a new password reset via the login form.",
|
||||
"id": Any<String>,
|
||||
"message": "Cannot reset password.",
|
||||
"property": null,
|
||||
"type": "BadRequestError",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Password reset reset password: unmatched token 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": "274",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API Reset all passwords reset all passwords returns 200 1: [body] 1`] = `Object {}`;
|
||||
|
||||
exports[`Authentication API Reset all passwords reset all passwords returns 200 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": "2",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
27
test/regression/api/admin/__snapshots__/site.test.js.snap
Normal file
27
test/regression/api/admin/__snapshots__/site.test.js.snap
Normal file
@ -0,0 +1,27 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Site API can retrieve config and all expected properties 1: [body] 1`] = `
|
||||
Object {
|
||||
"site": Object {
|
||||
"accent_color": "#FF1A75",
|
||||
"description": "Thoughts, stories and ideas",
|
||||
"icon": null,
|
||||
"logo": null,
|
||||
"title": "Ghost",
|
||||
"url": "http://127.0.0.1:2369/",
|
||||
"version": StringMatching /\\\\d\\+\\\\\\.\\\\d\\+/,
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Site API can retrieve config and all expected properties 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": "167",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
@ -1,9 +1,7 @@
|
||||
const {expect} = require('chai');
|
||||
const {any} = require('expect');
|
||||
const security = require('@tryghost/security');
|
||||
|
||||
const {agentProvider, mockManager, fixtureManager, any} = require('../../../utils/e2e-framework');
|
||||
const testUtils = require('../../../utils');
|
||||
const {agentProvider, mockManager, fixtureManager} = require('../../../utils/e2e-framework');
|
||||
const models = require('../../../../core/server/models');
|
||||
const settingsCache = require('../../../../core/shared/settings-cache');
|
||||
|
||||
@ -11,7 +9,7 @@ const settingsCache = require('../../../../core/shared/settings-cache');
|
||||
const sinon = require('sinon');
|
||||
const configUtils = require('../../../utils/configUtils');
|
||||
|
||||
describe('Authentication API canary', function () {
|
||||
describe('Authentication API', function () {
|
||||
let agent;
|
||||
let emailStub;
|
||||
|
||||
@ -29,15 +27,13 @@ describe('Authentication API canary', function () {
|
||||
});
|
||||
|
||||
it('is setup? no', async function () {
|
||||
const res = await agent
|
||||
await agent
|
||||
.get('authentication/setup')
|
||||
.expectStatus(200);
|
||||
|
||||
expect(res.body).to.matchSnapshot();
|
||||
expect(res.headers).to.matchSnapshot({
|
||||
date: any(String),
|
||||
etag: any(String)
|
||||
});
|
||||
.expectStatus(200)
|
||||
.matchBodySnapshot()
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
|
||||
it('complete setup', async function () {
|
||||
@ -49,7 +45,7 @@ describe('Authentication API canary', function () {
|
||||
});
|
||||
settingsCache.get.callThrough();
|
||||
|
||||
const res = await agent
|
||||
await agent
|
||||
.post('authentication/setup')
|
||||
.body({
|
||||
setup: [{
|
||||
@ -60,34 +56,30 @@ describe('Authentication API canary', function () {
|
||||
theme: 'TryGhost/Dawn'
|
||||
}]
|
||||
})
|
||||
.expectHeader('Content-Type', 'application/json; charset=utf-8')
|
||||
.expectStatus(201);
|
||||
|
||||
expect(res.body).to.matchSnapshot({
|
||||
users: [{
|
||||
created_at: any(Date),
|
||||
updated_at: any(Date)
|
||||
}]
|
||||
});
|
||||
expect(res.headers).to.matchSnapshot({
|
||||
date: any(String),
|
||||
etag: any(String)
|
||||
});
|
||||
.expectStatus(201)
|
||||
.matchBodySnapshot({
|
||||
users: [{
|
||||
created_at: any(String),
|
||||
updated_at: any(String)
|
||||
}]
|
||||
})
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
|
||||
// Test our side effects
|
||||
expect(emailStub.called).to.be.true;
|
||||
|
||||
expect(await settingsCache.get('active_theme')).to.eq('dawn');
|
||||
});
|
||||
|
||||
it('is setup? yes', async function () {
|
||||
const res = await agent
|
||||
.get('authentication/setup');
|
||||
|
||||
expect(res.body).to.matchSnapshot();
|
||||
expect(res.headers).to.matchSnapshot({
|
||||
date: any(String),
|
||||
etag: any(String)
|
||||
});
|
||||
await agent
|
||||
.get('authentication/setup')
|
||||
.matchBodySnapshot()
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
|
||||
it('complete setup again', function () {
|
||||
@ -101,15 +93,22 @@ describe('Authentication API canary', function () {
|
||||
blogTitle: 'a test blog'
|
||||
}]
|
||||
})
|
||||
.expectHeader('Content-Type', 'application/json; charset=utf-8')
|
||||
.expectStatus(403);
|
||||
.expectStatus(403)
|
||||
.matchBodySnapshot({
|
||||
errors: [{
|
||||
id: any(String)
|
||||
}]
|
||||
})
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
|
||||
it('update setup', async function () {
|
||||
await fixtureManager.init();
|
||||
await agent.loginAsOwner();
|
||||
|
||||
const res = await agent
|
||||
await agent
|
||||
.put('authentication/setup')
|
||||
.body({
|
||||
setup: [{
|
||||
@ -119,20 +118,17 @@ describe('Authentication API canary', function () {
|
||||
blogTitle: 'a test blog'
|
||||
}]
|
||||
})
|
||||
.expectHeader('Content-Type', 'application/json; charset=utf-8')
|
||||
.expectStatus(200);
|
||||
|
||||
expect(res.body).to.matchSnapshot({
|
||||
users: [{
|
||||
created_at: any(String),
|
||||
last_seen: any(String),
|
||||
updated_at: any(String)
|
||||
}]
|
||||
});
|
||||
expect(res.headers).to.matchSnapshot({
|
||||
date: any(String),
|
||||
etag: any(String)
|
||||
});
|
||||
.expectStatus(200)
|
||||
.matchBodySnapshot({
|
||||
users: [{
|
||||
created_at: any(String),
|
||||
last_seen: any(String),
|
||||
updated_at: any(String)
|
||||
}]
|
||||
})
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -147,26 +143,30 @@ describe('Authentication API canary', function () {
|
||||
it('check invite with invalid email', function () {
|
||||
return agent
|
||||
.get('authentication/invitation?email=invalidemail')
|
||||
.expectHeader('Content-Type', 'application/json; charset=utf-8')
|
||||
.expectStatus(400);
|
||||
.expectStatus(400)
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
|
||||
it('check valid invite', async function () {
|
||||
const res = await agent
|
||||
await agent
|
||||
.get(`authentication/invitation?email=${testUtils.DataGenerator.forKnex.invites[0].email}`)
|
||||
.expectHeader('Content-Type', 'application/json; charset=utf-8')
|
||||
.expectStatus(200);
|
||||
|
||||
expect(res.body).to.matchSnapshot();
|
||||
.expectStatus(200)
|
||||
.matchBodySnapshot()
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
|
||||
it('check invalid invite', async function () {
|
||||
const res = await agent
|
||||
await agent
|
||||
.get(`authentication/invitation?email=notinvited@example.org`)
|
||||
.expectHeader('Content-Type', 'application/json; charset=utf-8')
|
||||
.expectStatus(200);
|
||||
|
||||
expect(res.body).to.matchSnapshot();
|
||||
.expectStatus(200)
|
||||
.matchBodySnapshot()
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
|
||||
it('try to accept without invite', function () {
|
||||
@ -180,8 +180,10 @@ describe('Authentication API canary', function () {
|
||||
name: 'not invited'
|
||||
}]
|
||||
})
|
||||
.expectHeader('Content-Type', 'application/json; charset=utf-8')
|
||||
.expectStatus(404);
|
||||
.expectStatus(404)
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
|
||||
it('try to accept with invite and existing email address', function () {
|
||||
@ -195,12 +197,19 @@ describe('Authentication API canary', function () {
|
||||
name: 'invited'
|
||||
}]
|
||||
})
|
||||
.expectHeader('Content-Type', 'application/json; charset=utf-8')
|
||||
.expectStatus(422);
|
||||
.expectStatus(422)
|
||||
.matchBodySnapshot({
|
||||
errors: [{
|
||||
id: any(String)
|
||||
}]
|
||||
})
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
|
||||
it('try to accept with invite', async function () {
|
||||
const res = await agent
|
||||
await agent
|
||||
.post('authentication/invitation')
|
||||
.body({
|
||||
invitation: [{
|
||||
@ -210,10 +219,11 @@ describe('Authentication API canary', function () {
|
||||
name: 'invited'
|
||||
}]
|
||||
})
|
||||
.expectHeader('Content-Type', 'application/json; charset=utf-8')
|
||||
.expectStatus(200);
|
||||
|
||||
expect(res.body).to.matchSnapshot();
|
||||
.expectStatus(200)
|
||||
.matchBodySnapshot()
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -254,17 +264,15 @@ describe('Authentication API canary', function () {
|
||||
ne2Password: 'thisissupersafe'
|
||||
}]
|
||||
})
|
||||
.expectStatus(200);
|
||||
|
||||
expect(res.body).to.matchSnapshot();
|
||||
expect(res.headers).to.matchSnapshot({
|
||||
date: any(String),
|
||||
etag: any(String)
|
||||
});
|
||||
.expectStatus(200)
|
||||
.matchBodySnapshot()
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
|
||||
it('reset password: invalid token', async function () {
|
||||
const res = await agent
|
||||
await agent
|
||||
.put('authentication/passwordreset')
|
||||
.header('Accept', 'application/json')
|
||||
.body({
|
||||
@ -274,17 +282,15 @@ describe('Authentication API canary', function () {
|
||||
ne2Password: 'thisissupersafe'
|
||||
}]
|
||||
})
|
||||
.expectStatus(401);
|
||||
|
||||
expect(res.body).to.matchSnapshot({
|
||||
errors: [{
|
||||
id: any(String)
|
||||
}]
|
||||
});
|
||||
expect(res.headers).to.matchSnapshot({
|
||||
date: any(String),
|
||||
etag: any(String)
|
||||
});
|
||||
.expectStatus(401)
|
||||
.matchBodySnapshot({
|
||||
errors: [{
|
||||
id: any(String)
|
||||
}]
|
||||
})
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
|
||||
it('reset password: expired token', async function () {
|
||||
@ -298,7 +304,7 @@ describe('Authentication API canary', function () {
|
||||
password: ownerUser.get('password')
|
||||
});
|
||||
|
||||
const res = await agent
|
||||
await agent
|
||||
.put('authentication/passwordreset')
|
||||
.header('Accept', 'application/json')
|
||||
.body({
|
||||
@ -308,17 +314,15 @@ describe('Authentication API canary', function () {
|
||||
ne2Password: 'thisissupersafe'
|
||||
}]
|
||||
})
|
||||
.expectStatus(400);
|
||||
|
||||
expect(res.body).to.matchSnapshot({
|
||||
errors: [{
|
||||
id: any(String)
|
||||
}]
|
||||
});
|
||||
expect(res.headers).to.matchSnapshot({
|
||||
date: any(String),
|
||||
etag: any(String)
|
||||
});
|
||||
.expectStatus(400)
|
||||
.matchBodySnapshot({
|
||||
errors: [{
|
||||
id: any(String)
|
||||
}]
|
||||
})
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
|
||||
it('reset password: unmatched token', async function () {
|
||||
@ -329,7 +333,7 @@ describe('Authentication API canary', function () {
|
||||
password: 'invalid_password'
|
||||
});
|
||||
|
||||
const res = await agent
|
||||
await agent
|
||||
.put('authentication/passwordreset')
|
||||
.header('Accept', 'application/json')
|
||||
.body({
|
||||
@ -339,21 +343,19 @@ describe('Authentication API canary', function () {
|
||||
ne2Password: 'thisissupersafe'
|
||||
}]
|
||||
})
|
||||
.expectStatus(400);
|
||||
|
||||
expect(res.body).to.matchSnapshot({
|
||||
errors: [{
|
||||
id: any(String)
|
||||
}]
|
||||
});
|
||||
expect(res.headers).to.matchSnapshot({
|
||||
date: any(String),
|
||||
etag: any(String)
|
||||
});
|
||||
.expectStatus(400)
|
||||
.matchBodySnapshot({
|
||||
errors: [{
|
||||
id: any(String)
|
||||
}]
|
||||
})
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
|
||||
it('reset password: generate reset token', async function () {
|
||||
const res = await agent
|
||||
await agent
|
||||
.post('authentication/passwordreset')
|
||||
.header('Accept', 'application/json')
|
||||
.body({
|
||||
@ -361,13 +363,11 @@ describe('Authentication API canary', function () {
|
||||
email: user.email
|
||||
}]
|
||||
})
|
||||
.expectStatus(200);
|
||||
|
||||
expect(res.body).to.matchSnapshot();
|
||||
expect(res.headers).to.matchSnapshot({
|
||||
date: any(String),
|
||||
etag: any(String)
|
||||
});
|
||||
.expectStatus(200)
|
||||
.matchBodySnapshot()
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -388,17 +388,16 @@ describe('Authentication API canary', function () {
|
||||
});
|
||||
|
||||
it('reset all passwords returns 200', async function () {
|
||||
const res = await agent.post('authentication/reset_all_passwords')
|
||||
await agent.post('authentication/reset_all_passwords')
|
||||
.header('Accept', 'application/json')
|
||||
.body({})
|
||||
.expectStatus(200);
|
||||
|
||||
expect(res.body).to.matchSnapshot();
|
||||
expect(res.headers).to.matchSnapshot({
|
||||
date: any(String),
|
||||
etag: any(String)
|
||||
});
|
||||
.expectStatus(200)
|
||||
.matchBodySnapshot()
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
|
||||
// Check side effects
|
||||
// All users locked
|
||||
const users = await models.User.fetchAll();
|
||||
for (const user of users) {
|
||||
|
@ -1,258 +0,0 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Authentication API canary Blog setup complete setup 1`] = `
|
||||
Object {
|
||||
"users": Array [
|
||||
Object {
|
||||
"created_at": Any<Date>,
|
||||
"updated_at": Any<Date>,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Blog setup complete setup 2`] = `
|
||||
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": "434",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"date": Any<String>,
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-cache-invalidate": "/*",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Blog setup is setup? no 1`] = `
|
||||
Object {
|
||||
"setup": Array [
|
||||
Object {
|
||||
"status": false,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Blog setup is setup? no 2`] = `
|
||||
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": "28",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"date": Any<String>,
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Blog setup is setup? yes 1`] = `
|
||||
Object {
|
||||
"setup": Array [
|
||||
Object {
|
||||
"status": true,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Blog setup is setup? yes 2`] = `
|
||||
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": "27",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"date": Any<String>,
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Blog setup update setup 1`] = `
|
||||
Object {
|
||||
"users": Array [
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"last_seen": Any<String>,
|
||||
"updated_at": Any<String>,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Blog setup update setup 2`] = `
|
||||
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": "506",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"date": Any<String>,
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-cache-invalidate": "/*",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Invitation check invalid invite 1`] = `
|
||||
Object {
|
||||
"invitation": Array [
|
||||
Object {
|
||||
"valid": false,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Invitation check valid invite 1`] = `
|
||||
Object {
|
||||
"invitation": Array [
|
||||
Object {
|
||||
"valid": true,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Invitation try to accept with invite 1`] = `
|
||||
Object {
|
||||
"invitation": Array [
|
||||
Object {
|
||||
"message": "Invitation accepted.",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Password reset reset password 1`] = `
|
||||
Object {
|
||||
"passwordreset": Array [
|
||||
Object {
|
||||
"message": "Password changed successfully.",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Password reset reset password 2`] = `
|
||||
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": "64",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"date": Any<String>,
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Password reset reset password: expired token 1`] = `
|
||||
Object {
|
||||
"errors": Array [
|
||||
Object {
|
||||
"id": Any<String>,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Password reset reset password: expired token 2`] = `
|
||||
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": "260",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"date": Any<String>,
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Password reset reset password: generate reset token 1`] = `
|
||||
Object {
|
||||
"passwordreset": Array [
|
||||
Object {
|
||||
"message": "Check your email for further instructions.",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Password reset reset password: generate reset token 2`] = `
|
||||
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": "76",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"date": Any<String>,
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Password reset reset password: invalid token 1`] = `
|
||||
Object {
|
||||
"errors": Array [
|
||||
Object {
|
||||
"id": Any<String>,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Password reset reset password: invalid token 2`] = `
|
||||
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": "314",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"date": Any<String>,
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Password reset reset password: unmatched token 1`] = `
|
||||
Object {
|
||||
"errors": Array [
|
||||
Object {
|
||||
"id": Any<String>,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Password reset reset password: unmatched token 2`] = `
|
||||
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": "274",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"date": Any<String>,
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Authentication API canary Reset all passwords reset all passwords returns 200 1`] = `Object {}`;
|
||||
|
||||
exports[`Authentication API canary Reset all passwords reset all passwords returns 200 2`] = `
|
||||
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": "2",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"date": Any<String>,
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
@ -1,9 +1,7 @@
|
||||
const {expect} = require('chai');
|
||||
const {any, stringMatching} = require('expect');
|
||||
|
||||
const {any, stringMatching} = require('@tryghost/jest-snapshot');
|
||||
const {agentProvider} = require('../../../utils/e2e-framework');
|
||||
|
||||
describe('Config API', function () {
|
||||
describe('Site API', function () {
|
||||
let agent;
|
||||
|
||||
before(async function () {
|
||||
@ -11,15 +9,15 @@ describe('Config API', function () {
|
||||
});
|
||||
|
||||
it('can retrieve config and all expected properties', async function () {
|
||||
const res = await agent
|
||||
.get('site/');
|
||||
|
||||
expect(res.body.site).to.matchSnapshot({
|
||||
version: stringMatching(/\d+\.\d+/)
|
||||
});
|
||||
expect(res.headers).to.matchSnapshot({
|
||||
date: any(String),
|
||||
etag: any(String)
|
||||
});
|
||||
await agent
|
||||
.get('site/')
|
||||
.matchBodySnapshot({
|
||||
site: {
|
||||
version: stringMatching(/\d+\.\d+/)
|
||||
}
|
||||
})
|
||||
.matchHeaderSnapshot({
|
||||
etag: any(String)
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,26 +0,0 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Config API can retrieve config and all expected properties 1`] = `
|
||||
Object {
|
||||
"accent_color": "#FF1A75",
|
||||
"description": "Thoughts, stories and ideas",
|
||||
"icon": null,
|
||||
"logo": null,
|
||||
"title": "Ghost",
|
||||
"url": "http://127.0.0.1:2369/",
|
||||
"version": StringMatching /\\\\d\\+\\\\\\.\\\\d\\+/,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Config API can retrieve config and all expected properties 2`] = `
|
||||
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": "167",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"date": Any<String>,
|
||||
"etag": Any<String>,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
@ -14,6 +14,7 @@
|
||||
// The output state checker is responsible for checking the response from the app after performing a request.
|
||||
const _ = require('lodash');
|
||||
const {sequence} = require('@tryghost/promise');
|
||||
const {any, anything, stringMatching} = require('@tryghost/jest-snapshot');
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
@ -144,5 +145,8 @@ module.exports = {
|
||||
get: getFixture,
|
||||
init: initFixtures,
|
||||
reset: resetDb
|
||||
}
|
||||
},
|
||||
any,
|
||||
anything,
|
||||
stringMatching
|
||||
};
|
||||
|
@ -1,3 +1,6 @@
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'testing';
|
||||
|
||||
require('../../core/server/overrides');
|
||||
|
||||
const {mochaHooks} = require('@tryghost/jest-snapshot');
|
||||
exports.mochaHooks = mochaHooks;
|
||||
|
@ -1,14 +0,0 @@
|
||||
const chai = require('chai');
|
||||
const chaiJestSnapshot = require('@ethanresnick/chai-jest-snapshot');
|
||||
|
||||
chai.use(chaiJestSnapshot);
|
||||
|
||||
exports.mochaHooks = {
|
||||
beforeAll() {
|
||||
chaiJestSnapshot.resetSnapshotRegistry();
|
||||
},
|
||||
|
||||
beforeEach() {
|
||||
chaiJestSnapshot.configureUsingMochaContext(this);
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user