File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,30 @@ test("getting events for a given host", async () => {
23
23
} ) ;
24
24
} ) ;
25
25
26
+ test ( "metadata is included when includeMetadata query parameter is set" , async ( ) => {
27
+ const response = await fetch (
28
+ `${ baseEndpoint } /api/v1/events?host=Infrastructure Committee&includeMetadata=true&ts=${ Date . now ( ) } ` ,
29
+ ) ;
30
+ expect ( response . status ) . toBe ( 200 ) ;
31
+
32
+ const responseJson = ( await response . json ( ) ) as EventsGetResponse ;
33
+ expect ( responseJson . length ) . toBeGreaterThan ( 0 ) ;
34
+ const withMetadata = responseJson . filter ( ( x ) => x [ "metadata" ] ) ;
35
+ expect ( withMetadata . length ) . toBeGreaterThanOrEqual ( 1 ) ;
36
+ } ) ;
37
+
38
+ test ( "metadata is not included when includeMetadata query parameter is unset" , async ( ) => {
39
+ const response = await fetch (
40
+ `${ baseEndpoint } /api/v1/events?host=Infrastructure Committee&ts=${ Date . now ( ) } ` ,
41
+ ) ;
42
+ expect ( response . status ) . toBe ( 200 ) ;
43
+
44
+ const responseJson = ( await response . json ( ) ) as EventsGetResponse ;
45
+ expect ( responseJson . length ) . toBeGreaterThan ( 0 ) ;
46
+ const withMetadata = responseJson . filter ( ( x ) => x [ "metadata" ] ) ;
47
+ expect ( withMetadata . length ) . toEqual ( 0 ) ;
48
+ } ) ;
49
+
26
50
describe ( "Event lifecycle tests" , async ( ) => {
27
51
let createdEventUuid : string ;
28
52
test ( "creating an event" , { timeout : 30000 } , async ( ) => {
You can’t perform that action at this time.
0 commit comments