-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
nodefs.spec.js
40 lines (31 loc) · 1.03 KB
/
nodefs.spec.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
import { lgPromise } from './common.js';
import assert from 'assert';
import {rmSync} from 'fs';
describe('nodefs', function () {
this.timeout(20000);
it('should clone using nodefs', async () => {
const lg = await lgPromise;
const FS = lg.FS;
const NODEFS = FS.filesystems.NODEFS;
const clonedir = 'nodefsclonetest';
FS.mkdir('/nodefs');
FS.mount(NODEFS, { root: '.' }, '/nodefs');
FS.chdir('/nodefs');
FS.writeFile('/home/web_user/.gitconfig', `
[safe]
directory = nodefsclonetest
[user]
name = Test User
email = [email protected]
`);
// clone a repository from github
lg.callMain(['clone', 'https://github.com/petersalomonsen/wasm-git.git', clonedir]);
FS.chdir(clonedir);
console.log(FS.readdir('.'));
lg.callMain(['log']);
assert(FS.readdir('.').indexOf('README.md') > -1);
FS.chdir('..');
rmSync('clonedir', {recursive: true, force: true});
console.log('clone to nodefs suceeded');
});
});