File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ import { describe , expectTypeOf , it } from 'vitest' ;
2+ import type {
3+ DevToolsColor ,
4+ MarkerPayload ,
5+ TrackEntryPayload ,
6+ WithDevToolsPayload ,
7+ WithErrorColor ,
8+ } from './user-timing-extensibility-api.type.js' ;
9+
10+ describe ( 'TrackEntryPayload' , ( ) => {
11+ it ( 'TrackEntryPayload extends ExtensionTrackBase and TrackMeta' , ( ) => {
12+ expectTypeOf < {
13+ dataType ?: 'track-entry' ;
14+ track : string ;
15+ } > ( ) . toMatchTypeOf < TrackEntryPayload > ( ) ;
16+ } ) ;
17+ } ) ;
18+
19+ describe ( 'MarkerPayload' , ( ) => {
20+ it ( 'MarkerPayload extends ExtensionTrackBase with required dataType' , ( ) => {
21+ expectTypeOf < {
22+ dataType : 'marker' ;
23+ } > ( ) . toMatchTypeOf < MarkerPayload > ( ) ;
24+ } ) ;
25+ } ) ;
26+
27+ describe ( 'WithErrorColor' , ( ) => {
28+ it ( 'WithErrorColor removes optional color and adds required error color' , ( ) => {
29+ expectTypeOf < {
30+ color : 'error' ;
31+ otherProp : string ;
32+ } > ( ) . toMatchTypeOf <
33+ WithErrorColor < { color ?: DevToolsColor ; otherProp : string } >
34+ > ( ) ;
35+ } ) ;
36+ } ) ;
37+
38+ describe ( 'WithDevToolsPayload' , ( ) => {
39+ it ( 'WithDevToolsPayload makes devtools optional' , ( ) => {
40+ expectTypeOf < {
41+ devtools ?: TrackEntryPayload ;
42+ } > ( ) . toMatchTypeOf < WithDevToolsPayload < TrackEntryPayload > > ( ) ;
43+ } ) ;
44+ } ) ;
You can’t perform that action at this time.
0 commit comments