-
Notifications
You must be signed in to change notification settings - Fork 698
Expand file tree
/
Copy pathstatus_file.js
More file actions
85 lines (68 loc) · 2.36 KB
/
Copy pathstatus_file.js
File metadata and controls
85 lines (68 loc) · 2.36 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
var assert = require("assert");
describe("StatusFile", function() {
var NodeGit = require("../../");
var Status = NodeGit.Status;
var StatusFile = NodeGit.StatusFile;
var pathName = "README.md";
function testStatusFile(status) {
var statusFile = new StatusFile({
path: pathName,
status: Status.STATUS[status]
});
var specialFunction = status.replace(/^(WT|INDEX)_/, "");
specialFunction = "is" +
specialFunction[0] +
specialFunction.substring(1).toLowerCase();
if (/^WT_/.test(status)) {
assert.ok(statusFile.inWorkingTree());
assert.ok(!statusFile.inIndex());
}
if (/^INDEX_/.test(status)) {
assert.ok(!statusFile.inWorkingTree());
assert.ok(statusFile.inIndex());
}
assert.equal(statusFile.path(), pathName);
assert.equal(statusFile.statusBit(), Status.STATUS[status]);
assert.equal(statusFile.status(), status);
assert.ok(statusFile[specialFunction]());
}
it.skip("identifies the proper statuses for CURRENT", function() {
testStatusFile("CURRENT");
});
it.skip("identifies the proper statuses for WT_UNREADABLE", function() {
testStatusFile("WT_UNREADABLE");
});
it("identifies the proper statuses for WT_NEW", function() {
testStatusFile("WT_NEW");
});
it("identifies the proper statuses for WT_MODIFIED", function() {
testStatusFile("WT_MODIFIED");
});
it("identifies the proper statuses for WT_DELETED", function() {
testStatusFile("WT_DELETED");
});
it("identifies the proper statuses for WT_TYPECHANGE", function() {
testStatusFile("WT_TYPECHANGE");
});
it("identifies the proper statuses for WT_RENAMED", function() {
testStatusFile("WT_RENAMED");
});
it("identifies the proper statuses for IGNORED", function() {
testStatusFile("IGNORED");
});
it("identifies the proper statuses for INDEX_NEW", function() {
testStatusFile("INDEX_NEW");
});
it("identifies the proper statuses for INDEX_MODIFIED", function() {
testStatusFile("INDEX_MODIFIED");
});
it("identifies the proper statuses for INDEX_DELETED", function() {
testStatusFile("INDEX_DELETED");
});
it("identifies the proper statuses for INDEX_TYPECHANGE", function() {
testStatusFile("INDEX_TYPECHANGE");
});
it("identifies the proper statuses for INDEX_RENAMED", function() {
testStatusFile("INDEX_RENAMED");
});
});