diff options
Diffstat (limited to 'test/assertions.js')
-rw-r--r-- | test/assertions.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/assertions.js b/test/assertions.js index b40a518..a1c2eb9 100644 --- a/test/assertions.js +++ b/test/assertions.js @@ -9,3 +9,11 @@ should.Assertion.add('file', function(file, description) { this.obj.options.should.have.property('output').which.is.a.String; this.assert(fs.existsSync(path.resolve(this.obj.options.output, file))); }); + +should.Assertion.add('jsonfile', function(file, description) { + this.params = { operator: 'have valid jsonfile ' + file, message: description }; + + this.obj.should.have.property('options').which.is.an.Object; + this.obj.options.should.have.property('output').which.is.a.String; + this.assert(JSON.parse(fs.readFileSync(path.resolve(this.obj.options.output, file), { encoding: "utf-8" }))); +}); |