UNPKG

newman-reporter-confluence

Version:
74 lines (63 loc) 2.41 kB
var fs = require('fs'); describe('Newman Library', function () { var outFile = 'out/newman-report.wiki'; beforeEach(function (done) { fs.stat('out', function (err) { if (err) { return fs.mkdir('out', done); } done(); }); }); afterEach(function (done) { fs.stat(outFile, function (err) { if (err) { return done(); } fs.unlink(outFile, done); }); }); it('should correctly generate the report for a successful run', function (done) { newman.run({ collection: 'test/fixtures/single-get-request.json', reporters: ['confluence'], reporter: { confluence: { export: outFile } } }, function (err) { if (err) { return done(err); } fs.stat(outFile, done); }); }); it('should correctly generate the report for a failed run', function (done) { newman.run({ collection: 'test/fixtures/single-request-failing.json', reporters: ['confluence'], reporter: { confluence: { export: outFile } } }, function (err, summary) { expect(err).to.be.null; expect(summary.run.failures, 'should have 1 failure').to.have.lengthOf(1); fs.stat(outFile, done); }); }); it('should correctly produce the report for a run with AssertionError/TypeError', function (done) { newman.run({ collection: 'test/fixtures/newman-report-test.json', reporters: ['confluence'], reporter: { confluence: { export: outFile } } }, function (err, summary) { expect(err).to.be.null; expect(summary.run.failures, 'should have 2 failures').to.have.lengthOf(2); fs.stat(outFile, done); }); }); it('should correctly produce the report for a run with one or more failed requests', function (done) { newman.run({ collection: 'test/fixtures/failed-request.json', reporters: ['confluence'], reporter: { confluence: { export: outFile } } }, function (err, summary) { expect(err).to.be.null; expect(summary.run.failures, 'should have 1 failure').to.have.lengthOf(1); fs.stat(outFile, done); }); }); });