@@ -8,12 +8,14 @@ import { RedirectType } from '../..'
88const ogUrl = 'https://go.gov.sg'
99
1010// Mock the config module
11- jest . mock ( '../../../../config' , ( ) => ( {
12- logger : {
13- warn : jest . fn ( ) ,
14- } ,
15- ogUrl,
16- } ) )
11+ jest . mock ( '../../../../config' , ( ) => {
12+ return {
13+ logger : {
14+ warn : jest . fn ( ) ,
15+ } ,
16+ ogUrl : 'https://go.gov.sg' ,
17+ }
18+ } )
1719
1820// Mock dependencies
1921const mockUrlRepository = {
@@ -58,37 +60,37 @@ describe('RedirectService', () => {
5860 } )
5961
6062 describe ( 'referrer validation' , ( ) => {
61- it ( 'should show transition page for exact ogUrl match when user has not visited before' , async ( ) => {
63+ it ( 'should allow direct redirect for exact ogUrl match when user has not visited before' , async ( ) => {
6264 const result = await redirectService . redirectFor (
6365 'test' ,
6466 undefined ,
6567 'Mozilla/5.0' ,
6668 ogUrl ,
6769 )
6870
69- expect ( result . redirectType ) . toBe ( RedirectType . TransitionPage )
71+ expect ( result . redirectType ) . toBe ( RedirectType . Direct )
7072 } )
7173
72- it ( 'should show transition page for ogUrl with path when user has not visited before' , async ( ) => {
74+ it ( 'should allow direct redirect for ogUrl with path when user has not visited before' , async ( ) => {
7375 const result = await redirectService . redirectFor (
7476 'test' ,
7577 undefined ,
7678 'Mozilla/5.0' ,
7779 `${ ogUrl } /some-path` ,
7880 )
7981
80- expect ( result . redirectType ) . toBe ( RedirectType . TransitionPage )
82+ expect ( result . redirectType ) . toBe ( RedirectType . Direct )
8183 } )
8284
83- it ( 'should show transition page for ogUrl with query params when user has not visited before' , async ( ) => {
85+ it ( 'should allow direct redirect for ogUrl with query params when user has not visited before' , async ( ) => {
8486 const result = await redirectService . redirectFor (
8587 'test' ,
8688 undefined ,
8789 'Mozilla/5.0' ,
8890 `${ ogUrl } ?param=value` ,
8991 )
9092
91- expect ( result . redirectType ) . toBe ( RedirectType . TransitionPage )
93+ expect ( result . redirectType ) . toBe ( RedirectType . Direct )
9294 } )
9395
9496 it ( 'should show transition page for ogUrl with different protocol when user has not visited before' , async ( ) => {
0 commit comments