@drozdik.m/unit-test
Version:
Unit test with test cases with Assert functions. Simple and easy.
47 lines (40 loc) • 1.23 kB
text/typescript
import { TestCase } from "./TestCase";
export class SyncTestCase extends TestCase
{
//--------------------------------------------------
//----------PROPERTIES------------------------------
//--------------------------------------------------
//--------------------------------------------------
//----------CONSTRUCTOR-----------------------------
//--------------------------------------------------
/**
* Creates new instance of TestCase
* @param name Name of the test case
* @param useCaseFunction Function to run
*/
constructor(name: string, useCaseFunction: Function)
{
super(name, useCaseFunction);
}
//--------------------------------------------------
//----------METHODS---------------------------------
//--------------------------------------------------
Run()
{
try
{
this.useCaseFunction();
this.success = true;
}
catch (error)
{
this.success = false;
this.error = error;
}
this.isDone = true;
}
IsRunning(): boolean
{
return false;
}
}