Skip to content

Commit c3342e7

Browse files
committed
test around restoring
1 parent abd90e0 commit c3342e7

File tree

3 files changed

+2591
-0
lines changed

3 files changed

+2591
-0
lines changed

test/invalid.xml

Whitespace-only changes.

test/rrd-test.coffee

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
vows = require('vows')
22
assert = require('assert')
33
RRD = require('../rrd').RRD
4+
exec = require('child_process').exec
45

56
vows.describe('RRD').addBatch(
67
'created a database with invalid contents':
@@ -98,5 +99,26 @@ vows.describe('RRD').addBatch(
9899
# Need to figure out how to test this without messing up subsequent test runs
99100
# 'returns no error': (err) ->
100101
# assert.equal(err, undefined)
102+
'when restoring':
103+
'a valid file':
104+
topic: () ->
105+
RRD.restore('valid.xml', "tmp-restore.rrd", @callback)
106+
return
107+
108+
'returns no error': (err) ->
109+
assert.equal(err, null)
110+
111+
'an invalid file':
112+
topic: () ->
113+
RRD.restore('invalid.xml', "tmp-restore.rrd", @callback)
114+
return
115+
116+
# The underlying process never returns an error here.. need to figure out a better way to handle this
117+
# 'returns an error': (err) ->
118+
# assert.equal(err, 'some error')
119+
120+
).addBatch(
121+
'cleanup': () ->
122+
exec('rm tmp-*')
101123
).export(module, {error: false})
102124

0 commit comments

Comments
 (0)