auditjs
Version:
Audit dependencies to identify known vulnerabilities and maintenance problems
58 lines • 2.6 kB
JavaScript
;
/*
* Copyright 2019-Present Sonatype Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const TestHelper_1 = __importDefault(require("../Tests/TestHelper"));
const AuditIQServer_1 = require("./AuditIQServer");
const ReportStatus_1 = require("../Types/ReportStatus");
const sinon_1 = __importDefault(require("sinon"));
describe('AuditIQServer', () => {
before(() => {
sinon_1.default.stub(console, 'log');
sinon_1.default.stub(console, 'error');
});
after(() => {
sinon_1.default.restore();
});
it('should provide a true value if IQ Server Results have policy violations', () => {
const auditIqServer = new AuditIQServer_1.AuditIQServer();
const results = new ReportStatus_1.ReportStatus();
results.policyAction = 'Failure';
results.reportHtmlUrl = '';
const result = auditIqServer.auditThirdPartyResults(results);
(0, TestHelper_1.default)(result).to.equal(true);
});
it('should provide a true value if IQ Server Results have an isError value', () => {
const auditIqServer = new AuditIQServer_1.AuditIQServer();
const results = new ReportStatus_1.ReportStatus();
results.isError = true;
results.reportHtmlUrl = '';
const result = auditIqServer.auditThirdPartyResults(results);
(0, TestHelper_1.default)(result).to.equal(true);
});
it('should provide a false value if IQ Server Results have no policy violations', () => {
const auditIqServer = new AuditIQServer_1.AuditIQServer();
const results = new ReportStatus_1.ReportStatus();
results.policyAction = 'None';
results.reportHtmlUrl = '';
const result = auditIqServer.auditThirdPartyResults(results);
(0, TestHelper_1.default)(result).to.equal(false);
});
});
//# sourceMappingURL=AuditIQServer.spec.js.map