Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added I/O (sync) unit tests

  • Loading branch information...
commit 1b1eaca109640680747fc2e15cc5cf000c5627a4 1 parent bbdc0e2
SkyArrow authored

Showing 1 changed file with 72 additions and 0 deletions. Show diff stats Hide diff stats

  1. +72 0 test/iosync.js
72 test/iosync.js
... ... @@ -0,0 +1,72 @@
  1 +var qfs = require('..'),
  2 + path = require('path'),
  3 + dirname = __dirname;
  4 +
  5 +describe('I/O - sync', function(){
  6 + var dir, file;
  7 +
  8 + it('mkdir()', function(done){
  9 + qfs(dirname).mkdir('testDir');
  10 +
  11 + done();
  12 + });
  13 +
  14 + it('rename()', function(done){
  15 + qfs(dirname).children('testDir').rename('test');
  16 + dir = qfs(dirname).children('test');
  17 +
  18 + done();
  19 + });
  20 +
  21 + it('append() - dir', function(done){
  22 + dir.append('testFile');
  23 + file = dir.children('testFile');
  24 +
  25 + done();
  26 + });
  27 +
  28 + it('write()', function(done){
  29 + file.write('test');
  30 +
  31 + done();
  32 + });
  33 +
  34 + it('read()', function(done){
  35 + file.read().should.equal('test');
  36 +
  37 + done();
  38 + });
  39 +
  40 + it('content()', function(done){
  41 + file.content().should.equal('test');
  42 + file.content('test2').read().should.equal('test2');
  43 +
  44 + done();
  45 + });
  46 +
  47 + it('append() - file', function(done){
  48 + file.append('test').read().should.equal('test2test');
  49 +
  50 + done();
  51 + });
  52 +
  53 + it('empty() - file', function(done){
  54 + file.empty();
  55 + file.read().should.equal('');
  56 +
  57 + done();
  58 + });
  59 +
  60 + it('empty() - dir', function(done){
  61 + dir.empty();
  62 + dir.children().length.should.equal(0);
  63 +
  64 + done();
  65 + });
  66 +
  67 + it('remove()', function(done){
  68 + dir.remove();
  69 +
  70 + done();
  71 + });
  72 +});

0 comments on commit 1b1eaca

Please sign in to comment.
Something went wrong with that request. Please try again.