2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2023-11-21 14:52:38 +00:00
|
|
|
|
|
|
|
import { expect } from "./expect.ts";
|
2024-04-29 02:57:30 +00:00
|
|
|
import { AssertionError, assertThrows } from "@std/assert";
|
2023-11-21 14:52:38 +00:00
|
|
|
|
2024-02-08 22:00:55 +00:00
|
|
|
Deno.test("expect().toBeInstanceOf()", () => {
|
2023-11-21 14:52:38 +00:00
|
|
|
expect(new Error()).toBeInstanceOf(Error);
|
|
|
|
expect(new Error()).toBeInstanceOf(Object);
|
|
|
|
|
|
|
|
expect(new Error()).not.toBeInstanceOf(String);
|
|
|
|
|
|
|
|
assertThrows(() => {
|
|
|
|
expect(new Error()).toBeInstanceOf(String);
|
|
|
|
}, AssertionError);
|
|
|
|
|
|
|
|
assertThrows(() => {
|
|
|
|
expect(new Error()).not.toBeInstanceOf(Error);
|
|
|
|
}, AssertionError);
|
|
|
|
assertThrows(() => {
|
|
|
|
expect(new Error()).not.toBeInstanceOf(Object);
|
|
|
|
}, AssertionError);
|
|
|
|
});
|