@@ -5,6 +5,7 @@ import { FirebaseAppProvider, ObservableStatus, StorageProvider, useStorageDownl
5
5
import { baseConfig } from './appConfig' ;
6
6
import { renderHook , act as actOnHooks } from '@testing-library/react-hooks' ;
7
7
import * as React from 'react' ;
8
+ import { randomString } from './test-utils' ;
8
9
9
10
describe ( 'Storage' , ( ) => {
10
11
const app = initializeApp ( baseConfig ) ;
@@ -19,8 +20,9 @@ describe('Storage', () => {
19
20
20
21
describe ( 'useStorageTask' , ( ) => {
21
22
it ( 'returns the same value as uploadTask' , async ( ) => {
22
- const someBytes = Uint8Array . from ( Buffer . from ( new ArrayBuffer ( 1_000_000 ) ) ) ;
23
- const testFileRef = ref ( storage , 'test-useStorageTask/testfile.txt' ) ;
23
+ const someBytes = Uint8Array . from ( Buffer . from ( new ArrayBuffer ( 500_000 ) ) ) ;
24
+
25
+ const testFileRef = ref ( storage , `${ randomString ( ) } /${ randomString ( ) } .txt` ) ;
24
26
25
27
const uploadTask = uploadBytesResumable ( testFileRef , someBytes ) ;
26
28
@@ -68,8 +70,8 @@ describe('Storage', () => {
68
70
69
71
describe ( 'useStorageDownloadURL' , ( ) => {
70
72
it ( 'returns the same value as getDownloadURL' , async ( ) => {
71
- const someBytes = Uint8Array . from ( Buffer . from ( new ArrayBuffer ( 1_000_000 ) ) ) ;
72
- const testFileRef = ref ( storage , 'test-useStorageDownloadURL/testfile .txt' ) ;
73
+ const someBytes = Uint8Array . from ( Buffer . from ( new ArrayBuffer ( 500_000 ) ) ) ;
74
+ const testFileRef = ref ( storage , ` ${ randomString ( ) } / ${ randomString ( ) } .txt` ) ;
73
75
74
76
await uploadBytesResumable ( testFileRef , someBytes ) ;
75
77
0 commit comments