Skip to content

Commit 4f19f3b

Browse files
committed
Run prettier on merged files
1 parent f53c17a commit 4f19f3b

File tree

3 files changed

+65
-56
lines changed

3 files changed

+65
-56
lines changed

simple-git/src/lib/parsers/parse-fetch.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ const parsers: LineParser<FetchResult>[] = [
3232
from,
3333
});
3434
}
35-
)
35+
),
3636
];
3737

38-
export function parseFetchResult (stdOut: string, stdErr: string): FetchResult {
38+
export function parseFetchResult(stdOut: string, stdErr: string): FetchResult {
3939
const result: FetchResult = {
4040
raw: stdOut,
4141
remote: null,
4242
branches: [],
4343
tags: [],
4444
updated: [],
45-
deleted: []
45+
deleted: [],
4646
};
4747
return parseStringResponse(result, parsers, [stdOut, stdErr]);
4848
}

simple-git/test/integration/fetch.spec.ts

+8-15
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
// ./simple-git/test/integration/fetch.spec.ts
2-
3-
import {
4-
createTestContext,
5-
newSimpleGit,
6-
setUpInit,
7-
SimpleGitTestContext
8-
} from '../__fixtures__';
1+
import { createTestContext, newSimpleGit, setUpInit, SimpleGitTestContext } from '../__fixtures__';
92

103
describe('fetch', () => {
114
let context: SimpleGitTestContext;
@@ -35,26 +28,26 @@ describe('fetch', () => {
3528
branches: [
3629
{
3730
name: 'delta',
38-
tracking: 'origin/delta'
39-
}
31+
tracking: 'origin/delta',
32+
},
4033
],
4134
deleted: [{ tracking: 'origin/charlie' }],
4235
raw: '',
4336
remote: upstream,
4437
tags: [
4538
{
4639
name: 'alpha',
47-
tracking: 'alpha'
48-
}
40+
tracking: 'alpha',
41+
},
4942
],
5043
updated: [
5144
{
5245
from: bravoPriorHead.substring(0, 7),
5346
name: 'bravo',
5447
to: bravoCurrentHead.substring(0, 7),
55-
tracking: 'origin/bravo'
56-
}
57-
]
48+
tracking: 'origin/bravo',
49+
},
50+
],
5851
});
5952
});
6053

simple-git/test/unit/fetch.spec.ts

+54-38
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { promiseError } from '@kwsites/promise-result';
2-
import { assertExecutedCommands, assertGitError, closeWithSuccess, like, newSimpleGit } from './__fixtures__';
2+
import {
3+
assertExecutedCommands,
4+
assertGitError,
5+
closeWithSuccess,
6+
like,
7+
newSimpleGit,
8+
} from './__fixtures__';
39
import { SimpleGit } from '../../typings';
410
import { parseFetchResult } from '../../src/lib/parsers/parse-fetch';
511

@@ -15,7 +21,7 @@ describe('fetch', () => {
1521
it('runs escaped fetch', async () => {
1622
const branchPrefix = 'some-name';
1723
const ref = `'refs/heads/${branchPrefix}*:refs/remotes/origin/${branchPrefix}*'`;
18-
git.fetch(`origin`, ref, {'--depth': '2'}, callback);
24+
git.fetch(`origin`, ref, { '--depth': '2' }, callback);
1925
await closeWithSuccess();
2026
assertExecutedCommands('fetch', '--depth=2', 'origin', ref);
2127
});
@@ -29,11 +35,13 @@ describe('fetch', () => {
2935
`);
3036

3137
assertExecutedCommands('fetch', '--depth=2', 'foo', 'bar');
32-
expect(await queue).toEqual(like({
33-
branches: [{name: 'master', tracking: 'origin/master'}],
34-
remote: 'https://github.com/steveukx/git-js',
35-
tags: [{name: '0.11.0', tracking: '0.11.0'}],
36-
}));
38+
expect(await queue).toEqual(
39+
like({
40+
branches: [{ name: 'master', tracking: 'origin/master' }],
41+
remote: 'https://github.com/steveukx/git-js',
42+
tags: [{ name: '0.11.0', tracking: '0.11.0' }],
43+
})
44+
);
3745
});
3846

3947
it('git fetch with remote and branch', async () => {
@@ -49,7 +57,7 @@ describe('fetch', () => {
4957
});
5058

5159
it('git fetch with options', async () => {
52-
git.fetch({'--all': null}, callback);
60+
git.fetch({ '--all': null }, callback);
5361
await closeWithSuccess();
5462
assertExecutedCommands('fetch', '--all');
5563
});
@@ -60,66 +68,74 @@ describe('fetch', () => {
6068
assertExecutedCommands('fetch', '--all', '-v');
6169
});
6270

63-
6471
describe('failures', () => {
65-
6672
it('disallows upload-pack as remote/branch', async () => {
6773
const error = await promiseError(git.fetch('origin', '--upload-pack=touch ./foo'));
6874

6975
assertGitError(error, 'potential exploit argument blocked');
7076
});
7177

7278
it('disallows upload-pack as varargs', async () => {
73-
const error = await promiseError(git.fetch('origin', 'main', {
74-
'--upload-pack': 'touch ./foo'
75-
}));
79+
const error = await promiseError(
80+
git.fetch('origin', 'main', {
81+
'--upload-pack': 'touch ./foo',
82+
})
83+
);
7684

7785
assertGitError(error, 'potential exploit argument blocked');
7886
});
7987

8088
it('disallows upload-pack as varargs', async () => {
81-
const error = await promiseError(git.fetch('origin', 'main', [
82-
'--upload-pack', 'touch ./foo'
83-
]));
89+
const error = await promiseError(
90+
git.fetch('origin', 'main', ['--upload-pack', 'touch ./foo'])
91+
);
8492

8593
assertGitError(error, 'potential exploit argument blocked');
8694
});
87-
8895
});
8996

9097
describe('parser', () => {
9198
const REMOTE = '/tmp/x-remote';
9299

93100
it('parses updates', () => {
94-
const result = parseFetchResult(`
101+
const result = parseFetchResult(
102+
`
95103
From ${REMOTE}
96104
7d11f0c..3de1250 main -> origin/main
97105
* [new branch] c -> origin/c
98-
`, '');
99-
100-
expect(result).toEqual(like({
101-
remote: REMOTE,
102-
branches: [{name: 'c', tracking: 'origin/c'}],
103-
tags: [],
104-
updated: [{name: 'main', tracking: 'origin/main', from: '7d11f0c', to: '3de1250'}],
105-
deleted: [],
106-
}));
106+
`,
107+
''
108+
);
109+
110+
expect(result).toEqual(
111+
like({
112+
remote: REMOTE,
113+
branches: [{ name: 'c', tracking: 'origin/c' }],
114+
tags: [],
115+
updated: [{ name: 'main', tracking: 'origin/main', from: '7d11f0c', to: '3de1250' }],
116+
deleted: [],
117+
})
118+
);
107119
});
108120

109121
it('parses deletes', () => {
110-
const result = parseFetchResult(`
122+
const result = parseFetchResult(
123+
`
111124
From ${REMOTE}
112125
- [deleted] (none) -> origin/c
113-
`, '');
114-
115-
expect(result).toEqual(like({
116-
remote: REMOTE,
117-
branches: [],
118-
tags: [],
119-
updated: [],
120-
deleted: [{tracking: 'origin/c'}],
121-
}));
126+
`,
127+
''
128+
);
129+
130+
expect(result).toEqual(
131+
like({
132+
remote: REMOTE,
133+
branches: [],
134+
tags: [],
135+
updated: [],
136+
deleted: [{ tracking: 'origin/c' }],
137+
})
138+
);
122139
});
123140
});
124-
125141
});

0 commit comments

Comments
 (0)