@@ -12,35 +12,35 @@ test(`should get correct canonical subscription URL for development environment`
1212 config . httpUseOneSignalCom = true ;
1313
1414 const devUrlsOsTcDomain = AltOriginManager . getCanonicalSubscriptionUrls ( config , EnvironmentKind . Development ) ;
15- t . is ( devUrlsOsTcDomain . length , 2 ) ;
15+ t . is ( devUrlsOsTcDomain . length , 1 ) ;
1616 t . is ( devUrlsOsTcDomain [ 0 ] . host , new URL ( 'https://test.localhost:3001' ) . host ) ;
17- t . is ( devUrlsOsTcDomain [ 1 ] . host , new URL ( 'https://test.os.tc:3001' ) . host ) ;
1817
1918 config . httpUseOneSignalCom = false ;
2019
2120 const devUrls = AltOriginManager . getCanonicalSubscriptionUrls ( config , EnvironmentKind . Development ) ;
2221 t . is ( devUrls . length , 1 ) ;
23- t . is ( devUrls [ 0 ] . host , new URL ( 'https://test.os.tc :3001' ) . host ) ;
22+ t . is ( devUrls [ 0 ] . host , new URL ( 'https://test.localhost :3001' ) . host ) ;
2423} ) ;
2524
2625test ( `should get correct canonical subscription URL for staging environment` , async t => {
26+ const stagingDomain = "staging.onesignal.com" ;
27+ ( < any > global ) . __API_ORIGIN__ = stagingDomain ;
2728 const config = TestEnvironment . getFakeAppConfig ( ) ;
2829 config . subdomain = 'test' ;
2930 config . httpUseOneSignalCom = true ;
3031
3132 const browser = await TestEnvironment . stubDomEnvironment ( ) ;
32- browser . changeURL ( window , " http://staging-01.onesignal.com" ) ;
33+ browser . changeURL ( window , ` http://${ stagingDomain } ` ) ;
3334
3435 const stagingUrlsOsTcDomain = AltOriginManager . getCanonicalSubscriptionUrls ( config , EnvironmentKind . Staging ) ;
35- t . is ( stagingUrlsOsTcDomain . length , 2 ) ;
36- t . is ( stagingUrlsOsTcDomain [ 0 ] . host , new URL ( 'https://test.staging-01.onesignal.com' ) . host ) ;
37- t . is ( stagingUrlsOsTcDomain [ 1 ] . host , new URL ( 'https://test.os.tc' ) . host ) ;
36+ t . is ( stagingUrlsOsTcDomain . length , 1 ) ;
37+ t . is ( stagingUrlsOsTcDomain [ 0 ] . host , new URL ( `https://test.${ stagingDomain } ` ) . host ) ;
3838
39+ // staging does not support an alt domain so it should be the same.
3940 config . httpUseOneSignalCom = false ;
40-
4141 const stagingUrls = AltOriginManager . getCanonicalSubscriptionUrls ( config , EnvironmentKind . Staging ) ;
4242 t . is ( stagingUrls . length , 1 ) ;
43- t . is ( stagingUrls [ 0 ] . host , new URL ( ' https://test.os.tc' ) . host ) ;
43+ t . is ( stagingUrls [ 0 ] . host , new URL ( ` https://test.${ stagingDomain } ` ) . host ) ;
4444} ) ;
4545
4646test ( `should get correct canonical subscription URL for production environment` , async t => {
@@ -50,8 +50,8 @@ test(`should get correct canonical subscription URL for production environment`,
5050
5151 const prodUrlsOsTcDomain = AltOriginManager . getCanonicalSubscriptionUrls ( config , EnvironmentKind . Production ) ;
5252 t . is ( prodUrlsOsTcDomain . length , 2 ) ;
53- t . is ( prodUrlsOsTcDomain [ 0 ] . host , new URL ( 'https://test.onesignal.com ' ) . host ) ;
54- t . is ( prodUrlsOsTcDomain [ 1 ] . host , new URL ( 'https://test.os.tc ' ) . host ) ;
53+ t . is ( prodUrlsOsTcDomain [ 0 ] . host , new URL ( 'https://test.os.tc ' ) . host ) ;
54+ t . is ( prodUrlsOsTcDomain [ 1 ] . host , new URL ( 'https://test.onesignal.com ' ) . host ) ;
5555
5656 config . httpUseOneSignalCom = false ;
5757
0 commit comments