From 88a2fc7feaebdff9dfd7d53684a19f40705147a4 Mon Sep 17 00:00:00 2001 From: Sandip Date: Tue, 10 Oct 2023 11:21:16 +0530 Subject: [PATCH] test: fix some unit tests for skipGit property --- tests/config/create-express-config.test.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/config/create-express-config.test.ts b/tests/config/create-express-config.test.ts index cea3b92..5d0de49 100644 --- a/tests/config/create-express-config.test.ts +++ b/tests/config/create-express-config.test.ts @@ -8,6 +8,7 @@ describe('CreateExpressConfig', () => { expect(createExpressConfig.outputDirectory).toBeUndefined(); expect(createExpressConfig.description).toBeUndefined(); expect(createExpressConfig.template).toBeUndefined(); + expect(createExpressConfig.skipGit).toBe(false); }); it('should have a default description', () => { @@ -84,41 +85,43 @@ describe('CreateExpressConfig', () => { describe('toString', () => { it('should return the readable format of the instance', () => { - const createExpressConfig = new CreateExpressConfig('xarvis', '/path/to/xarvis', 'xarvis-cli', 'javascript'); + const createExpressConfig = new CreateExpressConfig('xarvis', '/path/to/xarvis', 'xarvis-cli', 'javascript', true); expect(createExpressConfig.toString()).toBe( - 'CreateExpressConfig(projectName: xarvis, outputDirectory: /path/to/xarvis, description: xarvis-cli, template: javascript)' + 'CreateExpressConfig(projectName: xarvis, outputDirectory: /path/to/xarvis, description: xarvis-cli, template: javascript, skipGit: true)' ); }); }); describe('copyWith', () => { it('returns the same object if no arguments are provided', () => { - const createExpressConfig = new CreateExpressConfig('xarvis', '/path/to/xarvis', 'xarvis-cli', 'javascript'); + const createExpressConfig = new CreateExpressConfig('xarvis', '/path/to/xarvis', 'xarvis-cli', 'javascript', true); expect(createExpressConfig.copyWith({})).toStrictEqual(createExpressConfig); }); it('returns the same object if every value is passed as undefined', () => { - const createExpressConfig = new CreateExpressConfig('xarvis', '/path/to/xarvis', 'xarvis-cli', 'javascript'); + const createExpressConfig = new CreateExpressConfig('xarvis', '/path/to/xarvis', 'xarvis-cli', 'javascript', true); expect( createExpressConfig.copyWith({ projectName: undefined, outputDirectory: undefined, description: undefined, template: undefined, + skipGit: undefined, }) ).toStrictEqual(createExpressConfig); }); it('returns the new instance with the updated value', () => { - const createExpressConfig = new CreateExpressConfig('xarvis', '/path/to/xarvis', 'xarvis-cli', 'javascript'); + const createExpressConfig = new CreateExpressConfig('xarvis', '/path/to/xarvis', 'xarvis-cli', 'javascript', true); expect( createExpressConfig.copyWith({ projectName: 'xarvis 2', outputDirectory: '/path/to/xarvis/2', description: 'xarvis cli 2', template: 'typescript', + skipGit: false, }) - ).toStrictEqual(new CreateExpressConfig('xarvis 2', '/path/to/xarvis/2', 'xarvis cli 2', 'typescript')); + ).toStrictEqual(new CreateExpressConfig('xarvis 2', '/path/to/xarvis/2', 'xarvis cli 2', 'typescript', false)); }); }); });