mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Prevent tests from erroring when calling validate.init()
refs: https://github.com/TryGhost/Toolbox/issues/389 Calling validate always uses the cache system, so this commit makes sure that the cache system is always initialised correctly by the tests.
This commit is contained in:
parent
98f0b6c7ce
commit
007adb6a33
1 changed files with 12 additions and 1 deletions
|
@ -6,11 +6,13 @@ const list = require('../../../../../core/server/services/themes/list');
|
|||
const gscan = require('gscan');
|
||||
const assert = require('assert');
|
||||
const adapterManager = require('../../../../../core/server/services/adapter-manager');
|
||||
const InMemoryCache = require('../../../../../core/server/adapters/cache/Memory');
|
||||
|
||||
describe('Themes', function () {
|
||||
let checkZipStub;
|
||||
let checkStub;
|
||||
let formatStub;
|
||||
let adapterStub;
|
||||
|
||||
beforeEach(function () {
|
||||
checkZipStub = sinon.stub(gscan, 'checkZip');
|
||||
|
@ -29,6 +31,15 @@ describe('Themes', function () {
|
|||
path: '/path/to/theme'
|
||||
};
|
||||
|
||||
beforeEach(function () {
|
||||
adapterStub = sinon.stub(adapterManager, 'getAdapter').returns(new InMemoryCache());
|
||||
validate.init();
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
adapterStub.restore();
|
||||
});
|
||||
|
||||
it('[success] validates a valid zipped theme', function () {
|
||||
checkZipStub.resolves({});
|
||||
formatStub.returns({results: {error: []}});
|
||||
|
@ -150,7 +161,7 @@ describe('Themes', function () {
|
|||
validate.init();
|
||||
});
|
||||
|
||||
it('Does an innitial check if not cached yet', async function () {
|
||||
it('Does an initial check if not cached yet', async function () {
|
||||
checkStub.resolves({});
|
||||
formatStub.returns({results: {error: [{hello: 'world'}]}});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue