Skip to content

Commit

Permalink
test(assertions): improve assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
nicojs committed Mar 11, 2021
1 parent 58c19a8 commit 320ad21
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/test-helpers/src/assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@ import { File } from '@stryker-mutator/api/core';
import { CheckResult, FailedCheckResult, CheckStatus } from '@stryker-mutator/api/check';

export function expectKilled(result: MutantRunResult): asserts result is KilledMutantRunResult {
assert.equal(result.status, MutantRunStatus.Killed);
assert.strictEqual(result.status, MutantRunStatus.Killed, result.status === MutantRunStatus.Error ? result.errorMessage : '');
}

export function expectFailed(result: TestResult): asserts result is FailedTestResult {
assert.equal(result.status, TestStatus.Failed);
assert.strictEqual(result.status, TestStatus.Failed);
}

export function expectCompleted(runResult: DryRunResult): asserts runResult is CompleteDryRunResult {
assert.equal(runResult.status, DryRunStatus.Complete);
assert.strictEqual(runResult.status, DryRunStatus.Complete, runResult.status === DryRunStatus.Error ? runResult.errorMessage : 'Timeout occurred');
}

export function expectCompileError(checkResult: CheckResult): asserts checkResult is FailedCheckResult {
assert.equal(checkResult.status, CheckStatus.CompileError);
assert.strictEqual(checkResult.status, CheckStatus.CompileError);
}

export function expectErrored(runResult: MutantRunResult): asserts runResult is ErrorMutantRunResult;
export function expectErrored(runResult: DryRunResult): asserts runResult is ErrorDryRunResult;
export function expectErrored(runResult: DryRunResult | MutantRunResult): asserts runResult is ErrorDryRunResult | MutantRunResult;
export function expectErrored(runResult: DryRunResult | MutantRunResult): void {
assert.equal(runResult.status, DryRunStatus.Error);
assert.strictEqual(runResult.status, DryRunStatus.Error);
}
export function expectSurvived(runResult: MutantRunResult): asserts runResult is SurvivedMutantRunResult {
assert.equal(runResult.status, MutantRunStatus.Survived);
assert.strictEqual(runResult.status, MutantRunStatus.Survived, runResult.status === MutantRunStatus.Error ? runResult.errorMessage : '');
}

export function expectTextFileEqual(actual: File, expected: File): void {
Expand Down

0 comments on commit 320ad21

Please sign in to comment.