Miroslav Jonaš 15d83258fe
feat(core): move git commit from generators to create-nx-workspace (#11633)
* fix(core): move git commit to create-nx-workspace

* fix(core): add git init to create-nx-plugin
2022-08-18 18:40:46 -04:00

29 lines
837 B
TypeScript

import { checkGitVersion } from './git';
import * as cp from 'child_process';
describe('checkGitVersion', () => {
const execSyncSpy = jest.spyOn(cp, 'execSync');
afterEach(() => {
jest.resetAllMocks();
});
it('should work with text before semver', () => {
execSyncSpy.mockReturnValue(Buffer.from(`git version 2.33.0`));
const result = checkGitVersion();
expect(result).toEqual('2.33.0');
});
it('should work with 4 digit versions', () => {
execSyncSpy.mockReturnValue(Buffer.from(`git version 2.33.0.5`));
const result = checkGitVersion();
expect(result).toEqual('2.33.0');
});
it('should work with msysgit versions', () => {
execSyncSpy.mockReturnValue(Buffer.from(`git version 1.8.3.msysgit.0`));
const result = checkGitVersion();
expect(result).toEqual('1.8.3');
});
});