You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test.equal(delta.oldFile().path(),'README.md','Old file path should match expected');
26
-
test.equal(delta.newFile().path(),'README.md','New file path should match expected');
27
-
test.equal(patch.size(),1,'Content array should be of known length');
28
-
varhunk=patch.hunk(0);
29
-
30
-
test.equal(hunk.lines,5,'Content array should be of known length');
31
-
test.equal(delta.status(),git.DiffList.Delta.Modified,'Status should be known type');
32
-
33
-
test.equal(patch.line(0,0).lineOrigin,git.DiffList.LineOrigin.Context,'First content item should be context');
34
-
test.equal(patch.line(0,1).lineOrigin,git.DiffList.LineOrigin.Context,'Second content item should be context');
35
-
test.equal(patch.line(0,2).lineOrigin,git.DiffList.LineOrigin.Context,'Third content item should be context');
36
-
37
-
varoldContent='__Before submitting a pull request, please ensure both unit tests and lint checks pass.__\n';
38
-
test.equal(patch.line(0,3).content,oldContent,'Old content should match known value');
39
-
test.equal(patch.line(0,3).lineOrigin,git.DiffList.LineOrigin.Deletion,'Fourth content item should be deletion');
40
-
test.equal(patch.line(0,3).length,90,'Fourth content length should match known value');
41
-
42
-
varnewContent='__Before submitting a pull request, please ensure both that you\'ve added unit tests to cover your shiny new code, and that all unit tests and lint checks pass.__\n';
43
-
test.equal(patch.line(0,4).content,newContent,'New content should match known value');
44
-
test.equal(patch.line(0,4).lineOrigin,git.DiffList.LineOrigin.Addition,'Fifth content item should be addition');
45
-
test.equal(patch.line(0,4).length,162,'Fifth content length should match known value');
46
-
test.done();
47
-
});
48
-
});
49
-
});
16
+
commit.getDiff(function(error,diffList){
17
+
test.equal(null,error,'Should not error');
18
+
19
+
diffList[0].patches().forEach(function(patch){
20
+
test.equal(null,error,'Should not error');
21
+
22
+
test.equal(patch.oldFile().path(),'README.md','Old file path should match expected');
23
+
test.equal(patch.newFile().path(),'README.md','New file path should match expected');
24
+
test.equal(patch.size(),1,'Content array should be of known length');
25
+
test.ok(patch.isModified(),'Status should be known type');
26
+
27
+
varhunk=patch.hunks()[0];
28
+
test.equal(hunk.size(),5,'Content array should be of known length');
29
+
varlines=hunk.lines();
30
+
31
+
test.equal(lines[0].lineOrigin,git.DiffList.LineOrigin.Context,'First content item should be context');
32
+
test.equal(lines[1].lineOrigin,git.DiffList.LineOrigin.Context,'Second content item should be context');
33
+
test.equal(lines[2].lineOrigin,git.DiffList.LineOrigin.Context,'Third content item should be context');
34
+
35
+
varoldContent='__Before submitting a pull request, please ensure both unit tests and lint checks pass.__\n';
36
+
test.equal(lines[3].content,oldContent,'Old content should match known value');
37
+
test.equal(lines[3].lineOrigin,git.DiffList.LineOrigin.Deletion,'Fourth content item should be deletion');
38
+
test.equal(lines[3].length,90,'Fourth content length should match known value');
39
+
40
+
varnewContent='__Before submitting a pull request, please ensure both that you\'ve added unit tests to cover your shiny new code, and that all unit tests and lint checks pass.__\n';
41
+
test.equal(lines[4].content,newContent,'New content should match known value');
42
+
test.equal(lines[4].lineOrigin,git.DiffList.LineOrigin.Addition,'Fifth content item should be addition');
43
+
test.equal(lines[4].length,162,'Fifth content length should match known value');
0 commit comments