2020-03-05 05:52:18 -05:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
|
|
import { assertThrows, unitTest } from "./test_util.ts";
|
|
|
|
|
|
|
|
unitTest(function testFnOverloading(): void {
|
|
|
|
// just verifying that you can use this test definition syntax
|
|
|
|
Deno.test("test fn overloading", (): void => {});
|
|
|
|
});
|
|
|
|
|
|
|
|
unitTest(function nameOfTestCaseCantBeEmpty(): void {
|
|
|
|
assertThrows(
|
|
|
|
() => {
|
|
|
|
Deno.test("", () => {});
|
|
|
|
},
|
2020-03-15 05:34:24 -04:00
|
|
|
TypeError,
|
|
|
|
"The test name can't be empty"
|
2020-03-05 05:52:18 -05:00
|
|
|
);
|
|
|
|
assertThrows(
|
|
|
|
() => {
|
|
|
|
Deno.test({
|
|
|
|
name: "",
|
2020-03-28 13:03:49 -04:00
|
|
|
fn: () => {},
|
2020-03-05 05:52:18 -05:00
|
|
|
});
|
|
|
|
},
|
2020-03-15 05:34:24 -04:00
|
|
|
TypeError,
|
|
|
|
"The test name can't be empty"
|
2020-03-05 05:52:18 -05:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
unitTest(function testFnCantBeAnonymous(): void {
|
|
|
|
assertThrows(
|
|
|
|
() => {
|
2020-03-28 13:03:49 -04:00
|
|
|
Deno.test(function () {});
|
2020-03-05 05:52:18 -05:00
|
|
|
},
|
2020-03-15 05:34:24 -04:00
|
|
|
TypeError,
|
|
|
|
"The test function can't be anonymous"
|
2020-03-05 05:52:18 -05:00
|
|
|
);
|
|
|
|
});
|