@@ -71,12 +71,27 @@ describe('Database Tests', () => {
71
71
) ;
72
72
} ) ;
73
73
74
+ it ( 'Can get database with upper case URL' , ( ) => {
75
+ const db = defaultApp . database ( 'http://fOO.EUW1.firebaseDATABASE.app' ) ;
76
+ expect ( db ) . to . be . ok ;
77
+ expect ( db . repo_ . repoInfo_ . namespace ) . to . equal ( 'foo' ) ;
78
+ expect ( db . ref ( ) . toString ( ) ) . to . equal (
79
+ 'https://foo.euw1.firebasedatabase.app/'
80
+ ) ;
81
+ } ) ;
82
+
74
83
it ( 'Can get database with localhost URL and port' , ( ) => {
75
84
const db = defaultApp . database ( 'http://localhost:80' ) ;
76
85
expect ( db ) . to . be . ok ;
77
86
expect ( db . ref ( ) . toString ( ) ) . to . equal ( 'http://localhost:80/' ) ;
78
87
} ) ;
79
88
89
+ it ( 'Can get database with a upper case localhost URL' , ( ) => {
90
+ const db = defaultApp . database ( 'http://LOCALHOST' ) ;
91
+ expect ( db ) . to . be . ok ;
92
+ expect ( db . ref ( ) . toString ( ) ) . to . equal ( 'https://localhost/' ) ;
93
+ } ) ;
94
+
80
95
it ( 'Can get database with localhost URL' , ( ) => {
81
96
const db = defaultApp . database ( 'http://localhost' ) ;
82
97
expect ( db ) . to . be . ok ;
@@ -120,10 +135,19 @@ describe('Database Tests', () => {
120
135
} ) . to . throw ( / D a t a b a s e i n i t i a l i z e d m u l t i p l e t i m e s / i) ;
121
136
} ) ;
122
137
138
+ it ( 'Databases with legacy domain' , ( ) => {
139
+ expect ( ( ) => {
140
+ defaultApp . database ( 'http://foo.firebase.com/' ) ;
141
+ } ) . to . throw ( / i s n o l o n g e r s u p p o r t e d / i) ;
142
+ } ) ;
143
+
123
144
it ( 'Databases with invalid custom URLs' , ( ) => {
124
145
expect ( ( ) => {
125
146
defaultApp . database ( 'not-a-url' ) ;
126
147
} ) . to . throw ( / C a n n o t p a r s e F i r e b a s e u r l / i) ;
148
+ expect ( ( ) => {
149
+ defaultApp . database ( 'http://foo.com' ) ;
150
+ } ) . to . throw ( / C a n n o t p a r s e F i r e b a s e u r l / i) ;
127
151
expect ( ( ) => {
128
152
defaultApp . database ( 'http://fblocal.com' ) ;
129
153
} ) . to . throw ( / C a n n o t p a r s e F i r e b a s e u r l / i) ;
0 commit comments