File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 11// Copyright 2018-2025 the Deno authors. MIT license.
2- import { assertEquals , assertExists } from "@std/assert" ;
2+ import { assertEquals , assertExists , assertThrows } from "@std/assert" ;
33import { format } from "./duration.ts" ;
4+ import type { FormatOptions } from "./duration.ts" ;
45
56Deno . test ( {
67 name : "format() handles duration since epoch" ,
@@ -90,3 +91,15 @@ Deno.test({
9091 assertEquals ( format ( 16.342 , { ignoreZero : true } ) , "16ms 342µs" ) ;
9192 } ,
9293} ) ;
94+
95+ Deno . test ( {
96+ name : "format() throws on invalid style option" ,
97+ fn ( ) {
98+ assertThrows (
99+ ( ) =>
100+ format ( 16.342 , { style : "invalid" as keyof FormatOptions [ "style" ] } ) ,
101+ TypeError ,
102+ 'style must be "narrow", "full", or "digital"!' ,
103+ ) ;
104+ } ,
105+ } ) ;
You can’t perform that action at this time.
0 commit comments