UNPKG

836 BJavaScriptView Raw
1var assert = require("assert");
2var file = require('../file-system');
3var path = require('path');
4var fs = require('fs');
5
6function getPath(filepath) {
7 return path.join(__dirname, filepath);
8}
9
10describe('extend fs', function() {
11 var allFiles = [
12 [
13 getPath('var/fs/1.html'),
14 getPath('var/fs/index.html')
15 ]
16 ];
17
18 before(function() {
19 allFiles.forEach(function(files) {
20 files.forEach(function(item) {
21 file.writeFileSync(item);
22 });
23 });
24 });
25
26 it('node fs object', function() {
27 assert.equal(file.fs, fs);
28 });
29
30 it('node origin methods', function() {
31 var srcPath = getPath('var/fs/mkdir');
32
33 file.fs.mkdirSync(srcPath);
34
35 var exists = file.existsSync(srcPath);
36
37 assert.equal(exists, true);
38 });
39
40 after(function() {
41 file.rmdirSync(getPath('var/fs'));
42 });
43});
\No newline at end of file