Skip to content

Commit

Permalink
Merge branch 'pr/368'
Browse files Browse the repository at this point in the history
  • Loading branch information
steveukx committed Jul 1, 2019
2 parents 164ad75 + b6b8067 commit 02e19c1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/responses/DiffSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function textFileChange (line, files) {
}

function binaryFileChange (line, files) {
line = line.match(/^(.+) \| Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)$/);
line = line.match(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)$/);
if (line) {
files.push({
file: line[1].trim(),
Expand Down
14 changes: 14 additions & 0 deletions test/unit/test-diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,18 @@ exports.diff = {

test.done();
},

'recognises binary files' (test) {

const summary = DiffSummary.parse(`
some/image.png | Bin 0 -> 9806 bytes
1 file changed, 1 insertion(+)
`);

test.deepEqual(summary.files, [
{ file: 'some/image.png', before: 0, after: 9806, binary: true },
]);

test.done();
},
};

0 comments on commit 02e19c1

Please sign in to comment.