From 8276d1ae08e5ecb04a37dd9b119a63426036e179 Mon Sep 17 00:00:00 2001 From: James Milner Date: Sat, 15 Dec 2018 14:55:08 +0000 Subject: [PATCH] Add multiple feature test --- tests/unit/registerCommands.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/unit/registerCommands.ts b/tests/unit/registerCommands.ts index a5cad873..da8eb2ad 100644 --- a/tests/unit/registerCommands.ts +++ b/tests/unit/registerCommands.ts @@ -258,7 +258,6 @@ registerSuite('registerCommands', { }) }; groupMap = getGroupMap(groupDef); - registerCommands(yargsStub, groupMap); consoleErrorStub = stub(console, 'error'); }, @@ -276,6 +275,16 @@ registerSuite('registerCommands', { assert.deepEqual(run.firstCall.args[1], { bar: 'bar', foo: 'foo' }); assert.isTrue(setStub.calledOnce); assert.deepEqual(setStub.firstCall.args[0], { foo: 'foo' }); + }, + 'should write all feature arguments to dojorc when save is passed'() { + process.argv = ['-f']; + const { run } = groupMap.get('group1').get('command1'); + registerCommands(yargsStub, groupMap); + yargsStub.command.secondCall.args[3]({ f: { feature1: 'foo', feature2: 'bar' }, save: true }); + assert.isTrue(run.calledOnce); + assert.deepEqual(run.firstCall.args[1], { f: { feature1: 'foo', feature2: 'bar' } }); + assert.isTrue(setStub.calledOnce); + assert.deepEqual(setStub.firstCall.args[0], { f: { feature1: 'foo', feature2: 'bar' } }); } } },