0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00
ghost/test/regression/api/canary/admin/site.test.js
Naz 3dfab7d682 Integrated chai-jest-snapshot
refs https://github.com/TryGhost/Toolbox/issues/129

- Minimal version of chai-jest-snapshot with property matcher support. It runs off the forked version of https://github.com/suchipi/chai-jest-snapshot
2021-12-09 22:20:54 +13:00

35 lines
1.1 KiB
JavaScript

const chai = require('chai');
const {expect} = require('chai');
const {any, stringMatching} = require('expect');
const chaiJestSnapshot = require('@ethanresnick/chai-jest-snapshot');
const framework = require('../../../../utils/e2e-framework');
const config = require('../../../../../core/shared/config');
chai.use(chaiJestSnapshot);
describe('Config API', function () {
let request;
before(async function () {
chaiJestSnapshot.resetSnapshotRegistry();
request = await framework.getAgent('/ghost/api/canary/admin/');
});
beforeEach(function () {
chaiJestSnapshot.configureUsingMochaContext(this);
});
it('can retrieve config and all expected properties', async function () {
const res = await request
.get('site/')
.set('Origin', config.get('url'));
expect(res.body.site).to.matchSnapshot({
version: stringMatching(/\d+\.\d+/)
});
expect(res.headers).to.matchSnapshot({
date: any(String),
etag: any(String)
});
});
});