Skip to content

Commit e4fd84e

Browse files
committed
attempt to make storage tests less flaky
1 parent 44fffd6 commit e4fd84e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/storage.test.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { FirebaseAppProvider, ObservableStatus, StorageProvider, useStorageDownl
55
import { baseConfig } from './appConfig';
66
import { renderHook, act as actOnHooks } from '@testing-library/react-hooks';
77
import * as React from 'react';
8+
import { randomString } from './test-utils';
89

910
describe('Storage', () => {
1011
const app = initializeApp(baseConfig);
@@ -19,8 +20,9 @@ describe('Storage', () => {
1920

2021
describe('useStorageTask', () => {
2122
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`);
2426

2527
const uploadTask = uploadBytesResumable(testFileRef, someBytes);
2628

@@ -68,8 +70,8 @@ describe('Storage', () => {
6870

6971
describe('useStorageDownloadURL', () => {
7072
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`);
7375

7476
await uploadBytesResumable(testFileRef, someBytes);
7577

0 commit comments

Comments
 (0)