File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 1
1
import { AppRoles , RunEnvironment } from "./roles.js" ;
2
+ import { OriginFunction } from "@fastify/cors" ;
2
3
3
- type GroupRoleMapping = Record < string , AppRoles [ ] > ;
4
- type AzureRoleMapping = Record < string , AppRoles [ ] > ;
4
+ // From @fastify /cors
5
+ type ArrayOfValueOrArray < T > = Array < ValueOrArray < T > > ;
6
+ type OriginType = string | boolean | RegExp ;
7
+ type ValueOrArray < T > = T | ArrayOfValueOrArray < T > ;
8
+
9
+ type GroupRoleMapping = Record < string , readonly AppRoles [ ] > ;
10
+ type AzureRoleMapping = Record < string , readonly AppRoles [ ] > ;
5
11
6
12
export type ConfigType = {
7
13
GroupRoleMapping : GroupRoleMapping ;
8
14
AzureRoleMapping : AzureRoleMapping ;
9
- ValidCorsOrigins : ( string | RegExp ) [ ] ;
15
+ ValidCorsOrigins : ValueOrArray < OriginType > | OriginFunction ;
10
16
AadValidClientId : string ;
11
17
} ;
12
18
@@ -60,6 +66,6 @@ const environmentConfig: EnvironmentConfigType = {
60
66
] ,
61
67
AadValidClientId : "5e08cf0f-53bb-4e09-9df2-e9bdc3467296" ,
62
68
} ,
63
- } as const ;
69
+ } ;
64
70
65
71
export { genericConfig , environmentConfig } ;
Original file line number Diff line number Diff line change 1
1
import { expect , test } from "vitest" ;
2
2
import { InternalServerError } from "../../src/errors/index.js" ;
3
- import { EventGetResponse } from "../../src/routes/events.js" ;
3
+ import { EventsGetResponse } from "../../src/routes/events.js" ;
4
4
5
5
const appKey = process . env . APPLICATION_KEY ;
6
6
if ( ! appKey ) {
@@ -12,6 +12,6 @@ const baseEndpoint = `https://${appKey}.aws.qa.acmuiuc.org`;
12
12
test ( "getting events" , async ( ) => {
13
13
const response = await fetch ( `${ baseEndpoint } /api/v1/events` ) ;
14
14
expect ( response . status ) . toBe ( 200 ) ;
15
- const responseJson = ( await response . json ( ) ) as EventGetResponse ;
15
+ const responseJson = ( await response . json ( ) ) as EventsGetResponse ;
16
16
expect ( responseJson . length ) . greaterThan ( 0 ) ;
17
17
} ) ;
You can’t perform that action at this time.
0 commit comments