std/internal/assertion_state_test.ts
eryue0220 6a4eb6cb91
fix(expect): support expect.hasAssertions() (#5901)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-09-19 14:38:32 +09:00

29 lines
1.0 KiB
TypeScript

// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "@std/assert";
import { AssertionState } from "./assertion_state.ts";
Deno.test("AssertionState checkAssertionErrorStateAndReset pass", () => {
const assertionState = new AssertionState();
assertionState.setAssertionTriggered(true);
assertEquals(assertionState.checkAssertionErrorStateAndReset(), false);
});
Deno.test("AssertionState checkAssertionErrorStateAndReset pass", () => {
const assertionState = new AssertionState();
assertionState.setAssertionTriggered(true);
assertEquals(assertionState.checkAssertionErrorStateAndReset(), false);
assertionState.setAssertionCheck(true);
assertEquals(assertionState.checkAssertionErrorStateAndReset(), true);
});
Deno.test("AssertionState checkAssertionErrorStateAndReset fail", () => {
const assertionState = new AssertionState();
assertionState.setAssertionCheck(true);
assertEquals(assertionState.checkAssertionErrorStateAndReset(), true);
});