summaryrefslogtreecommitdiff
path: root/std/testing/asserts_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/testing/asserts_test.ts')
-rw-r--r--std/testing/asserts_test.ts112
1 files changed, 56 insertions, 56 deletions
diff --git a/std/testing/asserts_test.ts b/std/testing/asserts_test.ts
index c3059ebac..7ea73b5c0 100644
--- a/std/testing/asserts_test.ts
+++ b/std/testing/asserts_test.ts
@@ -29,14 +29,14 @@ Deno.test("testingEqual", function (): void {
assert(
equal(
{ hello: "world", hi: { there: "everyone" } },
- { hello: "world", hi: { there: "everyone" } }
- )
+ { hello: "world", hi: { there: "everyone" } },
+ ),
);
assert(
!equal(
{ hello: "world", hi: { there: "everyone" } },
- { hello: "world", hi: { there: "everyone else" } }
- )
+ { hello: "world", hi: { there: "everyone else" } },
+ ),
);
assert(equal(/deno/, /deno/));
assert(!equal(/deno/, /node/));
@@ -45,8 +45,8 @@ Deno.test("testingEqual", function (): void {
assert(
!equal(
new Date(2019, 0, 3, 4, 20, 1, 10),
- new Date(2019, 0, 3, 4, 20, 1, 20)
- )
+ new Date(2019, 0, 3, 4, 20, 1, 20),
+ ),
);
assert(equal(new Set([1]), new Set([1])));
assert(!equal(new Set([1]), new Set([2])));
@@ -65,20 +65,20 @@ Deno.test("testingEqual", function (): void {
new Map([
["foo", "bar"],
["baz", "baz"],
- ])
- )
+ ]),
+ ),
);
assert(
equal(
new Map([["foo", new Map([["bar", "baz"]])]]),
- new Map([["foo", new Map([["bar", "baz"]])]])
- )
+ new Map([["foo", new Map([["bar", "baz"]])]]),
+ ),
);
assert(
equal(
new Map([["foo", { bar: "baz" }]]),
- new Map([["foo", { bar: "baz" }]])
- )
+ new Map([["foo", { bar: "baz" }]]),
+ ),
);
assert(
equal(
@@ -89,8 +89,8 @@ Deno.test("testingEqual", function (): void {
new Map([
["baz", "qux"],
["foo", "bar"],
- ])
- )
+ ]),
+ ),
);
assert(equal(new Map([["foo", ["bar"]]]), new Map([["foo", ["bar"]]])));
assert(!equal(new Map([["foo", "bar"]]), new Map([["bar", "baz"]])));
@@ -100,14 +100,14 @@ Deno.test("testingEqual", function (): void {
new Map([
["foo", "bar"],
["bar", "baz"],
- ])
- )
+ ]),
+ ),
);
assert(
!equal(
new Map([["foo", new Map([["bar", "baz"]])]]),
- new Map([["foo", new Map([["bar", "qux"]])]])
- )
+ new Map([["foo", new Map([["bar", "qux"]])]]),
+ ),
);
assert(equal(new Map([[{ x: 1 }, true]]), new Map([[{ x: 1 }, true]])));
assert(!equal(new Map([[{ x: 1 }, true]]), new Map([[{ x: 1 }, false]])));
@@ -120,13 +120,13 @@ Deno.test("testingEqual", function (): void {
assert(equal(new Uint8Array([1, 2, 3, 4]), new Uint8Array([1, 2, 3, 4])));
assert(!equal(new Uint8Array([1, 2, 3, 4]), new Uint8Array([2, 1, 4, 3])));
assert(
- equal(new URL("https://example.test"), new URL("https://example.test"))
+ equal(new URL("https://example.test"), new URL("https://example.test")),
);
assert(
!equal(
new URL("https://example.test"),
- new URL("https://example.test/with-path")
- )
+ new URL("https://example.test/with-path"),
+ ),
);
});
@@ -137,7 +137,7 @@ Deno.test("testingNotEquals", function (): void {
assertNotEquals("Denosaurus", "Tyrannosaurus");
assertNotEquals(
new Date(2019, 0, 3, 4, 20, 1, 10),
- new Date(2019, 0, 3, 4, 20, 1, 20)
+ new Date(2019, 0, 3, 4, 20, 1, 20),
);
let didThrow;
try {
@@ -172,7 +172,7 @@ Deno.test("testingArrayContains", function (): void {
assertArrayContains(fixtureObject, [{ deno: "luv" }]);
assertArrayContains(
Uint8Array.from([1, 2, 3, 4]),
- Uint8Array.from([1, 2, 3])
+ Uint8Array.from([1, 2, 3]),
);
assertThrows(
(): void => assertArrayContains(fixtureObject, [{ deno: "node" }]),
@@ -193,7 +193,7 @@ missing: [
{
deno: "node",
},
-]`
+]`,
);
});
@@ -204,7 +204,7 @@ Deno.test("testingAssertStringContainsThrow", function (): void {
} catch (e) {
assert(
e.message ===
- `actual: "Denosaurus from Jurassic" expected to contain: "Raptor"`
+ `actual: "Denosaurus from Jurassic" expected to contain: "Raptor"`,
);
assert(e instanceof AssertionError);
didThrow = true;
@@ -223,7 +223,7 @@ Deno.test("testingAssertStringMatchingThrows", function (): void {
} catch (e) {
assert(
e.message ===
- `actual: "Denosaurus from Jurassic" expected to match: "/Raptor/"`
+ `actual: "Denosaurus from Jurassic" expected to match: "/Raptor/"`,
);
assert(e instanceof AssertionError);
didThrow = true;
@@ -262,7 +262,7 @@ Deno.test("testingAssertFail", function (): void {
fail("foo");
},
AssertionError,
- "Failed assertion: foo"
+ "Failed assertion: foo",
);
});
@@ -276,11 +276,11 @@ Deno.test("testingAssertFailWithWrongErrorClass", function (): void {
fail("foo");
},
TypeError,
- "Failed assertion: foo"
+ "Failed assertion: foo",
);
},
AssertionError,
- `Expected error to be instance of "TypeError", but was "AssertionError"`
+ `Expected error to be instance of "TypeError", but was "AssertionError"`,
);
});
@@ -299,9 +299,9 @@ Deno.test("testingAssertThrowsAsyncWithReturnType", () => {
const createHeader = (): string[] => [
"",
"",
- ` ${gray(bold("[Diff]"))} ${red(bold("Actual"))} / ${green(
- bold("Expected")
- )}`,
+ ` ${gray(bold("[Diff]"))} ${red(bold("Actual"))} / ${
+ green(bold("Expected"))
+ }`,
"",
"",
];
@@ -332,7 +332,7 @@ Deno.test({
removed(`- ${yellow("1")}`),
added(`+ ${yellow("2")}`),
"",
- ].join("\n")
+ ].join("\n"),
);
},
});
@@ -348,7 +348,7 @@ Deno.test({
...createHeader(),
removed(`- ${yellow("1")}`),
added(`+ "1"`),
- ].join("\n")
+ ].join("\n"),
);
},
});
@@ -365,7 +365,7 @@ Deno.test({
+ "1",
"2",
3,
- ]`
+ ]`,
);
},
});
@@ -385,7 +385,7 @@ Deno.test({
+ ],
- b: "2",
- c: 3,
- }`
+ }`,
);
},
});
@@ -397,7 +397,7 @@ Deno.test({
(): void =>
assertEquals(
new Date(2019, 0, 3, 4, 20, 1, 10),
- new Date(2019, 0, 3, 4, 20, 1, 20)
+ new Date(2019, 0, 3, 4, 20, 1, 20),
),
AssertionError,
[
@@ -406,7 +406,7 @@ Deno.test({
removed(`- ${new Date(2019, 0, 3, 4, 20, 1, 10).toISOString()}`),
added(`+ ${new Date(2019, 0, 3, 4, 20, 1, 20).toISOString()}`),
"",
- ].join("\n")
+ ].join("\n"),
);
},
});
@@ -441,7 +441,7 @@ Deno.test({
+ 3,
+ ],
- b: 2,
- }`
+ }`,
);
},
});
@@ -457,7 +457,7 @@ Deno.test({
{
a: 1,
b: 2,
- }`
+ }`,
);
},
});
@@ -481,11 +481,11 @@ Deno.test("Assert Throws Non-Error Fail", () => {
throw "Panic!";
},
String,
- "Panic!"
+ "Panic!",
);
},
AssertionError,
- "A non-Error object was thrown."
+ "A non-Error object was thrown.",
);
assertThrows(
@@ -495,7 +495,7 @@ Deno.test("Assert Throws Non-Error Fail", () => {
});
},
AssertionError,
- "A non-Error object was thrown."
+ "A non-Error object was thrown.",
);
assertThrows(
@@ -505,7 +505,7 @@ Deno.test("Assert Throws Non-Error Fail", () => {
});
},
AssertionError,
- "A non-Error object was thrown."
+ "A non-Error object was thrown.",
);
});
@@ -517,11 +517,11 @@ Deno.test("Assert Throws Async Non-Error Fail", () => {
return Promise.reject("Panic!");
},
String,
- "Panic!"
+ "Panic!",
);
},
AssertionError,
- "A non-Error object was thrown or rejected."
+ "A non-Error object was thrown or rejected.",
);
assertThrowsAsync(
@@ -531,7 +531,7 @@ Deno.test("Assert Throws Async Non-Error Fail", () => {
});
},
AssertionError,
- "A non-Error object was thrown or rejected."
+ "A non-Error object was thrown or rejected.",
);
assertThrowsAsync(
@@ -541,7 +541,7 @@ Deno.test("Assert Throws Async Non-Error Fail", () => {
});
},
AssertionError,
- "A non-Error object was thrown or rejected."
+ "A non-Error object was thrown or rejected.",
);
assertThrowsAsync(
@@ -551,7 +551,7 @@ Deno.test("Assert Throws Async Non-Error Fail", () => {
});
},
AssertionError,
- "A non-Error object was thrown or rejected."
+ "A non-Error object was thrown or rejected.",
);
});
@@ -568,7 +568,7 @@ Deno.test("assertEquals diff for differently ordered objects", () => {
ccccccccccccccccccccccc: 1,
aaaaaaaaaaaaaaaaaaaaaaaa: 0,
bbbbbbbbbbbbbbbbbbbbbbbb: 0,
- }
+ },
);
},
AssertionError,
@@ -578,7 +578,7 @@ Deno.test("assertEquals diff for differently ordered objects", () => {
bbbbbbbbbbbbbbbbbbbbbbbb: 0,
- ccccccccccccccccccccccc: 0,
+ ccccccccccccccccccccccc: 1,
- }`
+ }`,
);
});
@@ -592,7 +592,7 @@ Deno.test("assert diff formatting", () => {
`{
a: 1,
b: 2,
-}`
+}`,
);
// Same for nested small objects.
@@ -609,7 +609,7 @@ Deno.test("assert diff formatting", () => {
"b",
],
},
-]`
+]`,
);
// Grouping is disabled.
@@ -623,7 +623,7 @@ Deno.test("assert diff formatting", () => {
"i",
"i",
"i",
-]`
+]`,
);
});
@@ -633,7 +633,7 @@ Deno.test("Assert Throws Parent Error", () => {
throw new AssertionError("Fail!");
},
Error,
- "Fail!"
+ "Fail!",
);
});
@@ -643,6 +643,6 @@ Deno.test("Assert Throws Async Parent Error", () => {
throw new AssertionError("Fail!");
},
Error,
- "Fail!"
+ "Fail!",
);
});