File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
apps/marketing/src/middleware/redirects/corporate/__tests__ Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,25 @@ describe('getRedirects', () => {
6262 ) ;
6363 } ) ;
6464
65+ it ( 'redirects /certificates/:session_id to studio.code.org/api/hour/certificates/:session_id' , ( ) => {
66+ const sessionID = '_1_537adb90bcf397109ef4358f4c66c493' ;
67+ const req = createMockRequest ( `/certificates/${ sessionID } ` ) ;
68+ getRedirects ( req ) ;
69+ expect ( getCachedRedirectResponse ) . toHaveBeenCalledWith (
70+ new URL ( `/api/hour/certificates/${ sessionID } ` , 'https://studio.code.org' ) ,
71+ { status : 308 } ,
72+ ) ;
73+ } ) ;
74+
75+ it ( 'does not redirect /certificates/blank to studio.code.org/api/hour/certificates/:session_id' , ( ) => {
76+ const req = createMockRequest ( `/certificates/blank` ) ;
77+ getRedirects ( req ) ;
78+ expect ( getCachedRedirectResponse ) . not . toHaveBeenCalledWith (
79+ new URL ( `/api/hour/certificates/blank` , 'https://studio.code.org' ) ,
80+ { status : 308 } ,
81+ ) ;
82+ } ) ;
83+
6584 it ( 'returns undefined for unrelated paths' , ( ) => {
6685 const req = createMockRequest ( '/other/path' ) ;
6786 const result = getRedirects ( req ) ;
You can’t perform that action at this time.
0 commit comments