Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Added quick fs example

Tj Holowaychukb8a02a4f836c
diff --git a/test/unit/fs.js b/test/unit/fs.js
new file mode 100644
index 00000000..33b2e6cf
--- /dev/null
+++ b/test/unit/fs.js
@@ -0,0 +1,20 @@
+
+var fs = require('fs');
+
+describe('fs', function(){
+ describe('.readFile()', function(){
+ describe('when the file exists', function(){
+ it('should succeed', function(done){
+ fs.writeFile('/tmp/mocha', 'wahoo', done)
+ })
+ })
+
+ describe('when the file does not exist', function(){
+ it('should fail', function(done){
+ // uncomment
+ // fs.readFile('/tmp/does-not-exist', done);
+ done();
+ })
+ })
+ })
+})
\ No newline at end of file