-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
48 lines (31 loc) · 1.12 KB
/
test.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import test from 'ava';
import path from 'path';
import { homedir } from 'os';
import fs from 'fs';
import getRemote from './index';
const fixtures = path.join(process.cwd(), 'test', 'fixtures');
test.before('move git to .git', async () => {
await fs.renameSync(path.join(fixtures, 'repo-no-commits', 'git'), path.join(fixtures, 'repo-no-commits', '.git'));
});
test.after.always('move .git to git', async () => {
await fs.renameSync(path.join(fixtures, 'repo-no-commits', '.git'), path.join(fixtures, 'repo-no-commits', 'git'));
});
test.serial('GET REMOTE | not empty', async (t) => {
const cwd = process.cwd();
const remote = await getRemote(cwd);
t.not(remote, '');
});
test.serial('GET REMOTE | is empty', async (t) => {
await process.chdir('test/fixtures/repo-no-commits');
const cwd = process.cwd();
const remote = await getRemote(cwd);
t.is(remote, '');
await process.chdir('../../..');
});
test.serial('GET REMOTE | error', async (t) => {
const cwd = process.cwd();
await process.chdir(homedir());
const remote = await getRemote(homedir());
t.is(remote, '');
await process.chdir(cwd);
});