Skip to content

Commit

Permalink
test: add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evanlucas committed Jul 29, 2015
1 parent 9b3ab80 commit 2ad2346
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ test('parseString should skip comments at end of line', function(t) {
t.end()
})

test('parseString should return empty object for empty string', function(t) {
var str = ''
t.deepEqual(read.parseString(''), {})
t.end()
})

test('parseString should skip invalid lines', function(t) {
var str = 'thisisatest'
t.deepEqual(read.parseString(str), {})
t.end()
})

test('parseFile should work', function(t) {
read.parseFile(fix, function(err, result) {
t.ifError(err)
Expand All @@ -66,6 +78,13 @@ test('parseFile should work', function(t) {
})
})

test('parseFile fails if fs.readFile fails', function(t) {
read.parseFile('dasfasdf', function(err, result) {
t.type(err, 'Error')
t.end()
})
})

test('parseFileSync should work', function(t) {
var result = read.parseFileSync(fix)
t.deepEqual(result, {
Expand Down

0 comments on commit 2ad2346

Please sign in to comment.