Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwellgerber committed Aug 9, 2018
1 parent b3e86cb commit f8e4eb6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/lib/binding.spec.js
Expand Up @@ -695,6 +695,13 @@ describe('Binding', function() {
assert.equal(String(file.getContent()), '');
});

it('generates error if file is directory (w)', function() {
var binding = new Binding(system);
assert.throws(function() {
binding.open('mock-dir', flags('w'));
});
});

it('generates error if file exists (wx)', function() {
var binding = new Binding(system);
assert.throws(function() {
Expand Down Expand Up @@ -764,6 +771,13 @@ describe('Binding', function() {
assert.equal(String(file.getContent()), 'one content');
});

it('generates error if file is directory (a)', function() {
var binding = new Binding(system);
assert.throws(function() {
binding.open('mock-dir', flags('a'));
});
});

it('opens a new file for appending (ax)', function() {
var binding = new Binding(system);
binding.open('new.txt', flags('ax'), parseInt('0664', 8));
Expand Down

0 comments on commit f8e4eb6

Please sign in to comment.