@@ -15,6 +15,7 @@ import firebase from 'firebase/app';
1515import 'firebase/firestore' ;
1616import fetch from 'node-fetch' ;
1717import { baseConfig } from './appConfig' ;
18+ import { randomString } from './test-utils' ;
1819
1920describe ( 'Firestore' , ( ) => {
2021 let app : firebase . app . App ;
@@ -44,7 +45,7 @@ describe('Firestore', () => {
4445
4546 return app
4647 . firestore ( )
47- . collection ( 'test' )
48+ . collection ( randomString ( ) )
4849 . add ( { a : 'hello' } ) ;
4950 } ) ;
5051
@@ -54,8 +55,8 @@ describe('Firestore', () => {
5455
5556 const ref = app
5657 . firestore ( )
57- . collection ( 'testDoc' )
58- . doc ( 'test1' ) ;
58+ . collection ( randomString ( ) )
59+ . doc ( randomString ( ) ) ;
5960
6061 await ref . set ( mockData ) ;
6162
@@ -78,9 +79,8 @@ describe('Firestore', () => {
7879
7980 const ref = app
8081 . firestore ( )
81- . collection ( 'testDoc' )
82- // 'readSuccess' is set to the data-testid={data.id} attribute
83- . doc ( 'readSuccess' ) ;
82+ . collection ( randomString ( ) )
83+ . doc ( randomString ( ) ) ;
8484
8585 await ref . set ( mockData ) ;
8686
@@ -103,8 +103,8 @@ describe('Firestore', () => {
103103 it ( 'works when the document does not exist, and does not update when it is created' , async ( ) => {
104104 const ref = app
105105 . firestore ( )
106- . collection ( 'testDoc' )
107- . doc ( 'emptydoc' ) ;
106+ . collection ( randomString ( ) )
107+ . doc ( randomString ( ) ) ;
108108
109109 const { result : subscribeResult , waitFor : waitForSubscribe } = renderHook ( ( ) => useFirestoreDoc < any > ( ref ) , { wrapper : Provider } ) ;
110110 const { result : onceResult , waitFor : waitForOnce } = renderHook ( ( ) => useFirestoreDocOnce < any > ( ref ) , { wrapper : Provider } ) ;
@@ -129,8 +129,8 @@ describe('Firestore', () => {
129129
130130 const ref = app
131131 . firestore ( )
132- . collection ( 'testDoc' )
133- . doc ( 'readSuccess' ) ;
132+ . collection ( randomString ( ) )
133+ . doc ( randomString ( ) ) ;
134134
135135 await ref . set ( mockData1 ) ;
136136 const { result : subscribeResult , waitFor : waitForSubscribe } = renderHook (
@@ -162,7 +162,7 @@ describe('Firestore', () => {
162162 const mockData1 = { a : 'hello' } ;
163163 const mockData2 = { a : 'goodbye' } ;
164164
165- const ref = app . firestore ( ) . collection ( 'testCollection' ) ;
165+ const ref = app . firestore ( ) . collection ( randomString ( ) ) ;
166166
167167 await ref . add ( mockData1 ) ;
168168 await ref . add ( mockData2 ) ;
@@ -179,7 +179,7 @@ describe('Firestore', () => {
179179 const mockData1 = { a : 'hello' } ;
180180 const mockData2 = { a : 'goodbye' } ;
181181
182- const ref = app . firestore ( ) . collection ( 'testCollection' ) ;
182+ const ref = app . firestore ( ) . collection ( randomString ( ) ) ;
183183 const filteredRef = ref . where ( 'a' , '==' , 'hello' ) ;
184184
185185 await ref . add ( mockData1 ) ;
@@ -207,7 +207,7 @@ describe('Firestore', () => {
207207 const mockData1 = { a : 'hello' } ;
208208 const mockData2 = { a : 'goodbye' } ;
209209
210- const ref = app . firestore ( ) . collection ( 'testCollection' ) ;
210+ const ref = app . firestore ( ) . collection ( randomString ( ) ) ;
211211
212212 await ref . add ( mockData1 ) ;
213213 await ref . add ( mockData2 ) ;
@@ -226,7 +226,7 @@ describe('Firestore', () => {
226226 const mockData1 = { a : 'hello' } ;
227227 const mockData2 = { a : 'goodbye' } ;
228228
229- const ref = app . firestore ( ) . collection ( 'testCollection' ) ;
229+ const ref = app . firestore ( ) . collection ( randomString ( ) ) ;
230230 const filteredRef = ref . where ( 'a' , '==' , 'hello' ) ;
231231
232232 await ref . add ( mockData1 ) ;
0 commit comments