-
-
Notifications
You must be signed in to change notification settings - Fork 313
/
plugin.pathspec.spec.ts
56 lines (42 loc) · 1.65 KB
/
plugin.pathspec.spec.ts
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { SimpleGit } from '../../typings';
import { assertExecutedCommands, closeWithSuccess, newSimpleGit } from './__fixtures__';
import { pathspec } from '../../src/lib/args/pathspec';
describe('suffixPathsPlugin', function () {
let git: SimpleGit;
beforeEach(() => (git = newSimpleGit()));
it('moves pathspec to end', async () => {
git.raw(['a', pathspec('b'), 'c']);
await closeWithSuccess();
assertExecutedCommands('a', 'c', '--', 'b');
});
it('moves multiple pathspecs to end', async () => {
git.raw(['a', pathspec('b'), 'c', pathspec('d'), 'e']);
await closeWithSuccess();
assertExecutedCommands('a', 'c', 'e', '--', 'b', 'd');
});
it('ignores processing after a pathspec split', async () => {
git.raw('a', pathspec('b'), '--', 'c', pathspec('d'), 'e');
await closeWithSuccess();
assertExecutedCommands('a', '--', 'b', 'c', 'd', 'e');
});
it('flattens pathspecs after an explicit splitter', async () => {
git.raw('a', '--', 'b', pathspec('c', 'd'), 'e');
await closeWithSuccess();
assertExecutedCommands('a', '--', 'b', 'c', 'd', 'e');
});
it('accepts multiple paths in one pathspec argument', async () => {
git.raw('a', pathspec('b', 'c'), 'd');
await closeWithSuccess();
assertExecutedCommands('a', 'd', '--', 'b', 'c');
});
it('accepted as value of an option', async () => {
git.pull({
foo: null,
blah1: pathspec('a', 'b'),
blah2: pathspec('c', 'd'),
bar: null,
});
await closeWithSuccess();
assertExecutedCommands('pull', 'foo', 'bar', '--', 'a', 'b', 'c', 'd');
});
});