Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var chai_1 = __importDefault(require("chai")); var chai_as_promised_1 = __importDefault(require("chai-as-promised")); var reader_1 = require("../lib/reader/reader"); var xml_1 = require("../lib/reader/xml"); var fs_extra_1 = require("fs-extra"); var path_1 = __importDefault(require("path")); chai_1.default.use(chai_as_promised_1.default); chai_1.default.should(); var sample_als = "sample-project Project/sample-project.als"; var manual_als = "test.als"; var manual_xml = "test.xml"; var invalid_file = "invalid-file"; var test_res = "./test/res"; var test_tmp = "./test/tmp"; var expect = chai_1.default.expect; describe('Reader', function () { describe('Load Reader', function () { // TODO: Put proper analutics to check how slow? this.slow(100); before(function () { // Create a copy of the sample files. // This is important as the parser modifies the origional file. fs_extra_1.copySync(test_res, test_tmp); }); after(function () { // Cleanup after test fs_extra_1.remove(test_tmp); }); it('When the valid gzipped als is given', function (done) { xml_1.loadXml(path_1.default.join(test_tmp, manual_xml)).then(function (expected_xml) { var reader = new reader_1.Reader(path_1.default.join(test_tmp, manual_als)); // eql is used instead of equal as the objects are not directly comparable reader.load().should.eventually.eql(expected_xml).notify(done); }); }); it('When the invalid file type is given', function (done) { var reader = new reader_1.Reader(path_1.default.join(test_tmp, "invalid-file")); reader.load().should.eventually.rejectedWith(reader_1.INVALID_FILE).notify(done); }); it('When the valid extracted(xml) als is given', function (done) { expect('Hello World').to.equal('Hello World'); done(); }); }); }); |