forked from steveukx/git-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathts-gitp-from-root.spec.ts
33 lines (25 loc) · 1.05 KB
/
ts-gitp-from-root.spec.ts
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
import { CleanOptions, CleanSummary, gitP, SimpleGit, TaskConfigurationError } from 'simple-git';
import { createTestContext, SimpleGitTestContext } from '../__fixtures__';
describe('TS Root Consumer', () => {
let context: SimpleGitTestContext;
beforeEach(async () => context = await createTestContext());
it('imports', () => {
expect(typeof gitP).toBe('function');
expect(CleanOptions).toEqual(expect.objectContaining({
'FORCE': 'f',
}));
});
it('finds types, enums and errors', async () => {
const git: SimpleGit = gitP(context.root);
await git.init();
await context.file('file.txt', 'content');
const error: TaskConfigurationError | CleanSummary = await git.clean(CleanOptions.DRY_RUN, ['--interactive'])
.catch((e: TaskConfigurationError) => e);
expect(error).toBeInstanceOf(Error);
const clean: CleanSummary = await git.clean(CleanOptions.FORCE);
expect(clean).toEqual(expect.objectContaining({
dryRun: false,
files: ['file.txt'],
}));
});
});