/
gitWorkflow.spec.js
35 lines (30 loc) · 1.06 KB
/
gitWorkflow.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* eslint no-underscore-dangle: 0 */
import path from 'path'
import tmp from 'tmp'
import execa from 'execa'
import { execGit } from '../src/gitWorkflow'
tmp.setGracefulCleanup()
describe('gitWorkflow', () => {
describe('execGit', () => {
it('should execute git in process.cwd if working copy is not specified', async () => {
await execGit(['init', 'param'])
expect(execa).toHaveBeenCalledWith('git', ['init', 'param'], {
cwd: path.resolve(process.cwd())
})
})
it('should execute git in a given working copy', async () => {
await execGit(['init', 'param'], { cwd: 'test/__fixtures__' })
expect(execa).toHaveBeenCalledWith('git', ['init', 'param'], {
cwd: path.resolve(process.cwd(), 'test', '__fixtures__')
})
})
it('should work with relative paths', async () => {
await execGit(['init', 'param'], {
cwd: 'test/__fixtures__'
})
expect(execa).toHaveBeenCalledWith('git', ['init', 'param'], {
cwd: path.resolve(process.cwd(), 'test', '__fixtures__')
})
})
})
})