describe('.destroy', function () { it('has destroy lifecycle event', function () { assume(Plugin.hooks.destroy).to.be.an('asyncfunction'); assume(Plugin.hooks.destroy).to.have.length(1); }); it('closes logger instance', async function () { const gasket = { logger: { close: sinon.spy() } }; await Plugin.hooks.destroy(gasket); assume(gasket.logger.close).is.called(); }); });
it('codeStyle question shown presents expected choices', async () => { await promptHook(gasket, context, { prompt }); const question = prompt.getCall(0).args[0][0]; assume(question.name).equals('codeStyle'); assume(question.choices).length(Object.keys(codeStyles).length - 1); assume(question.choices.map(c => c.value)).eqls(Object.keys(codeStyles).filter(name => name !== 'common')); });
describe('Files', () => { let mockFiles; beforeEach(() => { mockFiles = new Files(); }); it('keeps track of added globs', () => { assume(mockFiles).property('globs'); assume(mockFiles.globs).instanceOf(Array); }); it('adds files to globs', () => { mockFiles.add({ globs: ['some/file/path'] }); assume(mockFiles.globs).length(1); mockFiles.add({ globs: ['another/file/path'] }); assume(mockFiles.globs).length(2); }); it('add multiple file arguments to globs', () => { mockFiles.add({ globs: ['some/file/path', 'another/file/path'] }); assume(mockFiles.globs).length(2); }); });
describe('Plugin', () => { it('is an object', () => { assume(plugin).is.an('object'); }); it('has expected name', () => { assume(plugin).to.have.property('name', require('../package').name); }); it('has expected hooks', () => { const expected = [ 'start', 'metadata' ]; assume(plugin).to.have.property('hooks'); const hooks = Object.keys(plugin.hooks); assume(hooks).eqls(expected); assume(hooks).is.length(expected.length); }); });
it('runs on the init lifecycle event', function () { assume(Plugin.hooks.init.handler).to.be.an('asyncfunction'); assume(Plugin.hooks.init.handler).to.have.length(1); });
it('codeStyle question shown presents expected choices', async () => { await promptHook(gasket, context, { prompt }); const question = prompt.getCall(0).args[0][0]; assume(question.name).equals('codeStyle'); assume(question.choices).length(Object.keys(codeStyles).length - 1); assume(question.choices.map(c => c.value)).eqls(Object.keys(codeStyles).filter(name => name !== 'common')); });
it('runs on the init lifecycle event', function () { assume(Plugin.hooks.init.handler).to.be.an('asyncfunction'); assume(Plugin.hooks.init.handler).to.have.length(1); });
describe('.destroy', function () { it('has destroy lifecycle event', function () { assume(Plugin.hooks.destroy).to.be.an('asyncfunction'); assume(Plugin.hooks.destroy).to.have.length(1); }); it('closes logger instance', async function () { const gasket = { logger: { close: sinon.spy() } }; await Plugin.hooks.destroy(gasket); assume(gasket.logger.close).is.called(); }); });
describe('Plugin', () => { it('is an object', () => { assume(plugin).is.an('object'); }); it('has expected name', () => { assume(plugin).to.have.property('name', require('../package').name); }); it('has expected hooks', () => { const expected = [ 'metadata' ]; assume(plugin).to.have.property('hooks'); const hooks = Object.keys(plugin.hooks); assume(hooks).eqls(expected); assume(hooks).is.length(expected.length); }); });
describe('Plugin', function () { it('is an object', () => { assume(plugin).is.an('object'); }); it('has expected name', () => { assume(plugin).to.have.property('name', require('../package').name); }); it('has expected hooks', () => { const expected = [ 'prompt', 'create', 'postCreate' ]; assume(plugin).to.have.property('hooks'); const hooks = Object.keys(plugin.hooks); assume(hooks).eqls(expected); assume(hooks).is.length(expected.length); }); });
describe('Plugin', function () { it('is an object', () => { assume(plugin).is.an('object'); }); it('has expected name', () => { assume(plugin).to.have.property('name', require('../package').name); }); it('has expected hooks', () => { const expected = [ 'docsView' ]; assume(plugin).to.have.property('hooks'); const hooks = Object.keys(plugin.hooks); assume(hooks).eqls(expected); assume(hooks).is.length(expected.length); }); });