summaryrefslogtreecommitdiff
path: root/cli/js/testing_test.ts
blob: b47eb03e2740c925e8ab249f2020492e69b68e94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// 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("", () => {});
    },
    Error,
    "The name of test case can't be empty"
  );
  assertThrows(
    () => {
      Deno.test({
        name: "",
        fn: () => {}
      });
    },
    Error,
    "The name of test case can't be empty"
  );
});

unitTest(function testFnCantBeAnonymous(): void {
  assertThrows(
    () => {
      Deno.test(function() {});
    },
    Error,
    "Test function can't be anonymous"
  );
});