Skip to content

Commit

Permalink
Added new test.
Browse files Browse the repository at this point in the history
  • Loading branch information
jprichardson committed Mar 18, 2013
1 parent 24529bd commit edc2692
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ var fs = require('fs')
, jsonFile = require('jsonfile')
, fse = {};

for (var funcName in fs) {
var func = fs[funcName];
if (fs.hasOwnProperty(funcName)) {
if (typeof func == 'function')
fse[funcName] = func;
}
}
Object.keys(fs).forEach(function(key) {
var func = fs[key];
if (typeof func == 'function')
fse[key] = func;
});


fs = fse;

Expand Down
18 changes: 18 additions & 0 deletions test/fs-integration.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var testutil = require('testutil')
, fs = require('../')
, path = require('path')

var TEST_DIR;

describe('native fs', function() {
beforeEach(function() {
TEST_DIR = testutil.createTestDir('fs-extra')
})

it('should use native fs methods', function() {
var file = path.join(TEST_DIR, 'write.txt')
fs.writeFileSync(file, 'hello')
var data = fs.readFileSync(file, 'utf8')
EQ (data, 'hello')
})
})

0 comments on commit edc2692

Please sign in to comment.