Skip to content

Commit

Permalink
Update tests throughout
Browse files Browse the repository at this point in the history
  • Loading branch information
steveukx committed Sep 15, 2024
1 parent 962c578 commit 4107281
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 5 additions & 4 deletions simple-git/test/integration/log-name-status.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,22 @@ describe('log-name-status', function () {
const actual = await newSimpleGit(context.root).log(['--name-status']);

expect(actual.all).toEqual([
mockListLogLine('two', { b: DiffNameStatus.RENAMED }),
mockListLogLine('one', { a: DiffNameStatus.ADDED }),
mockListLogLine('two', { b: [DiffNameStatus.RENAMED, 'a'] }),
mockListLogLine('one', { a: [DiffNameStatus.ADDED] }),
]);
});
});

function mockListLogLine(message: string, changes: Record<string, DiffNameStatus>) {
const files: DiffResultTextFile[] = Object.entries(changes).map(([file, status]) => {
function mockListLogLine(message: string, changes: Record<string, [DiffNameStatus, string?]>) {
const files: DiffResultTextFile[] = Object.entries(changes).map(([file, [status, from]]) => {
return {
binary: false,
changes: 0,
deletions: 0,
file,
insertions: 0,
status,
from,
};
});
return like({
Expand Down
6 changes: 4 additions & 2 deletions simple-git/test/unit/diff.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,16 +328,18 @@ describe('diff', () => {
changes: 0,
insertions: 0,
deletions: 0,
status: 'M',
binary: false,
status: 'M',
from: undefined,
},
{
file: 'to',
changes: 0,
insertions: 0,
deletions: 0,
status: 'R',
binary: false,
status: 'R',
from: 'from',
},
],
})
Expand Down

0 comments on commit 4107281

Please sign in to comment.