Skip to content

Commit 0092614

Browse files
committed
Add a new test to fix issue #628
1 parent 52baa25 commit 0092614

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

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

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

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

0 commit comments

Comments
 (0)