@@ -48,48 +48,4 @@ describe("CORS tests", async () => {
4848 expect ( response . status ) . toBe ( 200 ) ;
4949 expect ( response . headers ) . not . toHaveProperty ( "access-control-allow-origin" ) ;
5050 } ) ;
51- test ( "Membership: Known URL is allowed in CORS" , async ( ) => {
52- const response = await fetch ( `${ baseEndpoint } /api/v1/healthz` , {
53- headers : {
54- Origin : "https://acmuiuc.pages.dev" ,
55- } ,
56- } ) ;
57- expect ( response . status ) . toBe ( 200 ) ;
58- expect ( response . headers . get ( "access-control-allow-origin" ) ) . toStrictEqual (
59- "https://acmuiuc.pages.dev" ,
60- ) ;
61- } ) ;
62- test ( "Membership: Known URL is preflight allowed in CORS" , async ( ) => {
63- const response = await fetch ( `${ baseEndpoint } /api/v1/healthz` , {
64- method : "OPTIONS" ,
65- headers : {
66- "Access-Control-Request-Method" : "GET" ,
67- Origin : "https://acmuiuc.pages.dev" ,
68- } ,
69- } ) ;
70- expect ( response . status ) . toBe ( 204 ) ;
71- expect ( response . headers . get ( "access-control-allow-origin" ) ) . toStrictEqual (
72- "https://acmuiuc.pages.dev" ,
73- ) ;
74- } ) ;
75- test ( "Membership: Unknown URL is not allowed in CORS" , async ( ) => {
76- const response = await fetch ( `${ baseEndpoint } /api/v1/membership/zzzzzz` , {
77- headers : {
78- Origin : "https://google.com" ,
79- } ,
80- } ) ;
81- expect ( response . status ) . toBe ( 200 ) ;
82- expect ( response . headers ) . not . toHaveProperty ( "access-control-allow-origin" ) ;
83- } ) ;
84- test ( "Membership: Unknown URL is preflight not allowed in CORS" , async ( ) => {
85- const response = await fetch ( `${ baseEndpoint } /api/v1/membership/zzzzzz` , {
86- method : "OPTIONS" ,
87- headers : {
88- "Access-Control-Request-Method" : "GET" ,
89- Origin : "https://google.com" ,
90- } ,
91- } ) ;
92- expect ( response . status ) . toBe ( 204 ) ;
93- expect ( response . headers ) . not . toHaveProperty ( "access-control-allow-origin" ) ;
94- } ) ;
9551} ) ;
0 commit comments