@@ -28,6 +28,7 @@ chai.use(sinonChai);
2828chai . use ( chaiAsPromised ) ;
2929
3030const expect = chai . expect ;
31+ const TEST_LINK_DOMAIN = 'project-id.firebaseapp.com' ;
3132
3233describe ( 'ActionCodeSettingsBuilder' , ( ) => {
3334 describe ( 'constructor' , ( ) => {
@@ -43,7 +44,10 @@ describe('ActionCodeSettingsBuilder', () => {
4344 installApp : true ,
4445 minimumVersion : '6' ,
4546 } ,
47+ // not removing this test since we are going to accept both dynamicLinkDomain
48+ // and linkDomain for the onboarding phase.
4649 dynamicLinkDomain : 'custom.page.link' ,
50+ linkDomain : TEST_LINK_DOMAIN ,
4751 } ) ) . not . to . throw ;
4852 } ) ;
4953
@@ -69,6 +73,7 @@ describe('ActionCodeSettingsBuilder', () => {
6973 minimumVersion : '6' ,
7074 } ,
7175 dynamicLinkDomain : 'custom.page.link' ,
76+ linkDomain : TEST_LINK_DOMAIN ,
7277 } as any ) ;
7378 } ) . to . throw ( AuthClientErrorCode . MISSING_CONTINUE_URI . message ) ;
7479 } ) ;
@@ -109,6 +114,20 @@ describe('ActionCodeSettingsBuilder', () => {
109114 } ) ;
110115 } ) ;
111116
117+ const invalidHostingDomains = [ null , NaN , 0 , 1 , true , false , '' ,
118+ [ TEST_LINK_DOMAIN ] , [ ] , { } , { a : 1 } , _ . noop ] ;
119+ invalidHostingDomains . forEach ( ( domain ) => {
120+ it ( 'should throw on invalid linkDomain:' + JSON . stringify ( domain ) , ( ) => {
121+ expect ( ( ) => {
122+ return new ActionCodeSettingsBuilder ( {
123+ url : 'https://www.example.com/path/file?a=1&b=2' ,
124+ handleCodeInApp : true ,
125+ linkDomain : domain ,
126+ } as any ) ;
127+ } ) . to . throw ( AuthClientErrorCode . INVALID_HOSTING_LINK_DOMAIN . message ) ;
128+ } ) ;
129+ } ) ;
130+
112131 const invalidIOSSettings = [ null , NaN , 0 , 1 , true , false , '' , 'a' , [ ] , [ 1 , 'a' ] , _ . noop ] ;
113132 invalidIOSSettings . forEach ( ( settings ) => {
114133 it ( 'should throw on invalid iOS object:' + JSON . stringify ( settings ) , ( ) => {
@@ -228,11 +247,13 @@ describe('ActionCodeSettingsBuilder', () => {
228247 minimumVersion : '6' ,
229248 } ,
230249 dynamicLinkDomain : 'custom.page.link' ,
250+ linkDomain : TEST_LINK_DOMAIN ,
231251 } ) ;
232252 const expectedRequest = {
233253 continueUrl : 'https://www.example.com/path/file?a=1&b=2' ,
234254 canHandleCodeInApp : true ,
235255 dynamicLinkDomain : 'custom.page.link' ,
256+ linkDomain : TEST_LINK_DOMAIN ,
236257 androidPackageName : 'com.example.android' ,
237258 androidMinimumVersion : '6' ,
238259 androidInstallApp : true ,
0 commit comments