UNPKG

@drozdik.m/unit-test

Version:

Unit test with test cases with Assert functions. Simple and easy.

52 lines (51 loc) 2.02 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); exports.__esModule = true; var TestCase_1 = require("./TestCase"); var SyncTestCase = /** @class */ (function (_super) { __extends(SyncTestCase, _super); //-------------------------------------------------- //----------PROPERTIES------------------------------ //-------------------------------------------------- //-------------------------------------------------- //----------CONSTRUCTOR----------------------------- //-------------------------------------------------- /** * Creates new instance of TestCase * @param name Name of the test case * @param useCaseFunction Function to run */ function SyncTestCase(name, useCaseFunction) { return _super.call(this, name, useCaseFunction) || this; } //-------------------------------------------------- //----------METHODS--------------------------------- //-------------------------------------------------- SyncTestCase.prototype.Run = function () { try { this.useCaseFunction(); this.success = true; } catch (error) { this.success = false; this.error = error; } this.isDone = true; }; SyncTestCase.prototype.IsRunning = function () { return false; }; return SyncTestCase; }(TestCase_1.TestCase)); exports.SyncTestCase = SyncTestCase;