diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-02-11 17:24:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-11 17:24:27 +0100 |
commit | 61273085e40fb4d992eef4b1b5601e3567c80664 (patch) | |
tree | 1ac0f401d4cb897bdb6f88e3a5c47fece2856f89 /std/datetime/test.ts | |
parent | e0bcecee6042b219c6626172851af5a25362b948 (diff) |
refactor: rewrite tests in std/ to use Deno.test (#3930)
Diffstat (limited to 'std/datetime/test.ts')
-rw-r--r-- | std/datetime/test.ts | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/std/datetime/test.ts b/std/datetime/test.ts index 1958c6fab..979fd34be 100644 --- a/std/datetime/test.ts +++ b/std/datetime/test.ts @@ -1,9 +1,8 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -import { test } from "../testing/mod.ts"; import { assertEquals, assertThrows } from "../testing/asserts.ts"; import * as datetime from "./mod.ts"; -test(function parseDateTime(): void { +Deno.test(function parseDateTime(): void { assertEquals( datetime.parseDateTime("01-03-2019 16:30", "mm-dd-yyyy hh:mm"), new Date(2019, 0, 3, 16, 30) @@ -30,7 +29,7 @@ test(function parseDateTime(): void { ); }); -test(function invalidParseDateTimeFormatThrows(): void { +Deno.test(function invalidParseDateTimeFormatThrows(): void { assertThrows( (): void => { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -41,7 +40,7 @@ test(function invalidParseDateTimeFormatThrows(): void { ); }); -test(function parseDate(): void { +Deno.test(function parseDate(): void { assertEquals( datetime.parseDate("01-03-2019", "mm-dd-yyyy"), new Date(2019, 0, 3) @@ -56,7 +55,7 @@ test(function parseDate(): void { ); }); -test(function invalidParseDateFormatThrows(): void { +Deno.test(function invalidParseDateFormatThrows(): void { assertThrows( (): void => { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -67,17 +66,17 @@ test(function invalidParseDateFormatThrows(): void { ); }); -test(function DayOfYear(): void { +Deno.test(function DayOfYear(): void { assertEquals(1, datetime.dayOfYear(new Date("2019-01-01T03:24:00"))); assertEquals(70, datetime.dayOfYear(new Date("2019-03-11T03:24:00"))); assertEquals(365, datetime.dayOfYear(new Date("2019-12-31T03:24:00"))); }); -test(function currentDayOfYear(): void { +Deno.test(function currentDayOfYear(): void { assertEquals(datetime.currentDayOfYear(), datetime.dayOfYear(new Date())); }); -test({ +Deno.test({ name: "[DateTime] to IMF", fn(): void { const actual = datetime.toIMF(new Date(Date.UTC(1994, 3, 5, 15, 32))); @@ -86,7 +85,7 @@ test({ } }); -test({ +Deno.test({ name: "[DateTime] to IMF 0", fn(): void { const actual = datetime.toIMF(new Date(0)); |