std/expect/_assertion_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

34 lines
896 B
TypeScript

// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { describe, it, test } from "@std/testing/bdd";
import { expect } from "./expect.ts";
Deno.test("expect.hasAssertions() API", () => {
describe("describe suite", () => {
// FIXME(eryue0220): This test should throw `toThrowErrorMatchingSnapshot`
it("should throw an error", () => {
expect.hasAssertions();
});
it("should pass", () => {
expect.hasAssertions();
expect("a").toEqual("a");
});
});
it("it() suite should pass", () => {
expect.hasAssertions();
expect("a").toEqual("a");
});
// FIXME(eryue0220): This test should throw `toThrowErrorMatchingSnapshot`
test("test suite should throw an error", () => {
expect.hasAssertions();
});
test("test suite should pass", () => {
expect.hasAssertions();
expect("a").toEqual("a");
});
});