1 var test = require('tap').test
2 var fs = require('../graceful-fs.js')
4 test('graceful fs is monkeypatched fs', function (t) {
5 t.equal(fs, require('../fs.js'))
9 test('open an existing file works', function (t) {
10 var fd = fs.openSync(__filename, 'r')
12 fs.open(__filename, 'r', function (er, fd) {
14 fs.close(fd, function (er) {
22 test('open a non-existing file throws', function (t) {
25 var fd = fs.openSync('this file does not exist', 'r')
29 t.ok(er, 'should throw')
30 t.notOk(fd, 'should not get an fd')
31 t.equal(er.code, 'ENOENT')
33 fs.open('neither does this file', 'r', function (er, fd) {
34 t.ok(er, 'should throw')
35 t.notOk(fd, 'should not get an fd')
36 t.equal(er.code, 'ENOENT')