summaryrefslogtreecommitdiff
path: root/testing/pretty_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'testing/pretty_test.ts')
-rw-r--r--testing/pretty_test.ts31
1 files changed, 16 insertions, 15 deletions
diff --git a/testing/pretty_test.ts b/testing/pretty_test.ts
index 89b35c088..0262bfcfd 100644
--- a/testing/pretty_test.ts
+++ b/testing/pretty_test.ts
@@ -1,8 +1,9 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assert } from "./mod.ts";
+import { test } from "./mod.ts";
import { red, green, white, gray, bold } from "../colors/mod.ts";
-import { assertEqual } from "./pretty.ts";
+import { assertEq } from "./pretty.ts";
+import { assertThrows } from "./asserts.ts";
const createHeader = (): string[] => [
"",
@@ -18,19 +19,19 @@ const removed: (s: string) => string = (s: string): string => red(bold(s));
test({
name: "pass case",
fn() {
- assertEqual({ a: 10 }, { a: 10 });
- assertEqual(true, true);
- assertEqual(10, 10);
- assertEqual("abc", "abc");
- assertEqual({ a: 10, b: { c: "1" } }, { a: 10, b: { c: "1" } });
+ assertEq({ a: 10 }, { a: 10 });
+ assertEq(true, true);
+ assertEq(10, 10);
+ assertEq("abc", "abc");
+ assertEq({ a: 10, b: { c: "1" } }, { a: 10, b: { c: "1" } });
}
});
test({
name: "failed with number",
fn() {
- assert.throws(
- () => assertEqual(1, 2),
+ assertThrows(
+ () => assertEq(1, 2),
Error,
[...createHeader(), removed(`- 1`), added(`+ 2`), ""].join("\n")
);
@@ -40,8 +41,8 @@ test({
test({
name: "failed with number vs string",
fn() {
- assert.throws(
- () => assertEqual(1, "1"),
+ assertThrows(
+ () => assertEq(1, "1"),
Error,
[...createHeader(), removed(`- 1`), added(`+ "1"`)].join("\n")
);
@@ -51,8 +52,8 @@ test({
test({
name: "failed with array",
fn() {
- assert.throws(
- () => assertEqual([1, "2", 3], ["1", "2", 3]),
+ assertThrows(
+ () => assertEq([1, "2", 3], ["1", "2", 3]),
Error,
[
...createHeader(),
@@ -71,8 +72,8 @@ test({
test({
name: "failed with object",
fn() {
- assert.throws(
- () => assertEqual({ a: 1, b: "2", c: 3 }, { a: 1, b: 2, c: [3] }),
+ assertThrows(
+ () => assertEq({ a: 1, b: "2", c: 3 }, { a: 1, b: 2, c: [3] }),
Error,
[
...createHeader(),