Skip to content

Commit 168eeb4

Browse files
committed
Add a new test to fix issue #628
1 parent 7ab6f5e commit 168eeb4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/spec/fs.writeFile-readFile.spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ describe('fs.writeFile, fs.readFile', function() {
5050
});
5151
});
5252

53+
it('should write a string when given a number for the data', function(done) {
54+
var fs = util.fs();
55+
var contents = 7;
56+
var contentsAsString = '7';
57+
58+
fs.writeFile('/myfile', contents, function(error) {
59+
if(error) throw error;
60+
61+
fs.readFile('/myfile', 'utf8', function(error, data) {
62+
expect(error).not.to.exist;
63+
expect(data).to.equal(contentsAsString);
64+
done();
65+
});
66+
});
67+
});
68+
5369
it('should write, read a utf8 file with "utf8" option to writeFile', function(done) {
5470
const fs = util.fs();
5571
const contents = 'This is a file.';

0 commit comments

Comments
 (0)