-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathcommit_test.js
More file actions
112 lines (91 loc) · 3.01 KB
/
commit_test.js
File metadata and controls
112 lines (91 loc) · 3.01 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
'use strict';
var command = require('../lib/commands').commit;
var Test = require('./_common');
describe('commit', function () {
it('should commit', function (done) {
var options = {
ignoreEmpty: true
};
var files = [
'test.txt',
'test2.txt'
];
new Test(command, options, files)
.expect(['add', 'test.txt'])
.expect(['add', 'test2.txt'])
.expect(['diff', '--cached', '--exit-code'], [null, 'diff', 1])
.expect(['commit', '-m', 'Commit'])
.run(done);
});
it('should use the specified commit message', function (done) {
var options = {
message: 'Testing!'
};
var files = [
'test.txt'
];
new Test(command, options, files)
.expect(['add', 'test.txt'])
.expect(['diff', '--cached', '--exit-code'], [null, 'diff', 1])
.expect(['commit', '-m', 'Testing!'])
.run(done);
});
it('should add files with the force flag', function (done) {
var options = {
force: true
};
var files = [
'test.txt',
'test2.txt'
];
new Test(command, options, files)
.expect(['add', '--force', 'test.txt'])
.expect(['add', '--force', 'test2.txt'])
.expect(['diff', '--cached', '--exit-code'], [null, 'diff', 1])
.expect(['commit', '-m', 'Commit'])
.run(done);
});
it('should not fail when there are no unstaged changes', function (done) {
var options = {
ignoreEmpty: false
};
new Test(command, options)
.expect(['diff', '--cached', '--exit-code'], [null, '', 0])
.expect(['commit', '-m', 'Commit'])
.run(done);
});
it('should not commit when there are no unstaged changes', function (done) {
var options = {
ignoreEmpty: true
};
new Test(command, options)
.expect(['diff', '--cached', '--exit-code'], [null, '', 0])
.run(done);
});
it('should add --no-verify arg when noVerify is true', function (done) {
var options = {
noVerify: true
};
var files = [
'test.txt'
];
new Test(command, options, files)
.expect(['add', 'test.txt'])
.expect(['diff', '--cached', '--exit-code'], [null, 'diff', 1])
.expect(['commit', '-m', 'Commit', '--no-verify'])
.run(done);
});
it('should add --no-status arg when noStatus is true', function (done) {
var options = {
noStatus: true
};
var files = [
'test.txt'
];
new Test(command, options, files)
.expect(['add', 'test.txt'])
.expect(['diff', '--cached', '--exit-code'], [null, 'diff', 1])
.expect(['commit', '-m', 'Commit', '--no-status'])
.run(done);
});
});