it('eslintConfig question shown when codeStyle is `other`', async () => { await promptHook(gasket, context, { prompt }); const question = prompt.getCall(0).args[0][1]; assume(question.name).equals('eslintConfig'); assume(question.when({ codeStyle: 'other' })).true(); assume(question.when({ codeStyle: 'godaddy' })).not.true(); assume(question.when({ codeStyle: 'standard' })).not.true(); assume(question.when({ codeStyle: 'none' })).not.true(); });
describe('index', () => { it('exposes expected function', () => { const utils = require('../lib'); const expected = [ 'tryRequire', 'applyEnvironmentOverrides', 'runShellCommand', 'PackageManager' ]; assume(expected.every(k => k in utils)).true(); assume(Object.keys(utils)).lengthOf(expected.length); }); });
it('calls info with the correct package manager', async function () { stdout = '{}'; runner = sinon.stub().resolves({ stdout }); PackageManager = manager(runner); const pkg = new PackageManager({ packageManager }); await pkg.info(); assume(runner.called).is.true(); assume(runner.firstCall.args[0]).contains(packageManager); assume(runner.firstCall.args[1]).contains('info'); });
it('addStylelint question shown only codeStyle has support', async () => { await promptHook(gasket, context, { prompt }); const question = prompt.getCall(0).args[0][2]; assume(question.name).equals('addStylelint'); assume(question.when({ codeStyle: 'other' })).true(); assume(question.when({ codeStyle: 'godaddy' })).true(); assume(question.when({ codeStyle: 'standard' })).not.true(); });
it('calls info with the --json flag', async function () { stdout = '{}'; runner = sinon.stub().resolves({ stdout }); PackageManager = manager(runner); const pkg = new PackageManager({ packageManager }); await pkg.info(); assume(runner.called).is.true(); assume(runner.firstCall.args[1]).contains('--json'); });
it('stylelintConfig question shown when codeStyle is `other`', async () => { await promptHook(gasket, context, { prompt }); const question = prompt.getCall(0).args[0][3]; assume(question.name).equals('stylelintConfig'); assume(question.when({ addStylelint: true, codeStyle: 'other' })).true(); assume(question.when({ addStylelint: true, codeStyle: 'godaddy' })).not.true(); });
it('addStylelint question shown only codeStyle has support', async () => { await promptHook(gasket, context, { prompt }); const question = prompt.getCall(0).args[0][2]; assume(question.name).equals('addStylelint'); assume(question.when({ codeStyle: 'other' })).true(); assume(question.when({ codeStyle: 'godaddy' })).true(); assume(question.when({ codeStyle: 'standard' })).not.true(); });
it('eslintConfig question shown when codeStyle is `other`', async () => { await promptHook(gasket, context, { prompt }); const question = prompt.getCall(0).args[0][1]; assume(question.name).equals('eslintConfig'); assume(question.when({ codeStyle: 'other' })).true(); assume(question.when({ codeStyle: 'godaddy' })).not.true(); assume(question.when({ codeStyle: 'standard' })).not.true(); assume(question.when({ codeStyle: 'none' })).not.true(); });
it('calls info with the --json flag', async function () { stdout = '{}'; runner = sinon.stub().resolves({ stdout }); PackageManager = manager(runner); const pkg = new PackageManager({ packageManager }); await pkg.info(); assume(runner.called).is.true(); assume(runner.firstCall.args[1]).contains('--json'); });
describe('index', () => { it('exposes expected function', () => { const utils = require('../lib'); const expected = [ 'tryRequire', 'applyEnvironmentOverrides', 'runShellCommand', 'PackageManager' ]; assume(expected.every(k => k in utils)).true(); assume(Object.keys(utils)).lengthOf(expected.length); }); });