all files / core/results/ test-case-result.ts

100% Statements 23/23
100% Branches 6/6
100% Functions 6/6
100% Lines 22/22
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               5321× 5321× 5321×     6932× 73× 41×     32×     6859× 14×     6845×     5224×     5229×     13×      
import { TestOutcome } from "./test-outcome";
import { ITest } from "../_interfaces/test.i";
import { MatchError } from "../_errors";
 
export class TestCaseResult {
 
    private _test: ITest;
    private _arguments: Array<any>;
    private _error: Error;
 
    public constructor(test: ITest, testCaseArguments: Array<any>, error?: Error) {
        this._test = test;
        this._arguments = testCaseArguments;
        this._error = error;
    }
 
    public get outcome(): TestOutcome {
        if (this._error) {
            if (this._error instanceof MatchError) {
                return TestOutcome.Fail;
            }
 
            return TestOutcome.Error;
        }
 
        if (this._test.ignored) {
            return TestOutcome.Skip;
        }
 
        return TestOutcome.Pass;
    }
 
    public get test(): ITest {
        return this._test;
    }
 
    public get arguments() {
        return this._arguments;
    }
 
    public get error(): Error {
        return this._error;
    }
 
}