Skip to content

Commit

Permalink
attempt to make storage tests less flaky
Browse files Browse the repository at this point in the history
  • Loading branch information
jhuleatt committed Sep 7, 2021
1 parent 44fffd6 commit e4fd84e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/storage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { FirebaseAppProvider, ObservableStatus, StorageProvider, useStorageDownl
import { baseConfig } from './appConfig';
import { renderHook, act as actOnHooks } from '@testing-library/react-hooks';
import * as React from 'react';
import { randomString } from './test-utils';

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

describe('useStorageTask', () => {
it('returns the same value as uploadTask', async () => {
const someBytes = Uint8Array.from(Buffer.from(new ArrayBuffer(1_000_000)));
const testFileRef = ref(storage, 'test-useStorageTask/testfile.txt');
const someBytes = Uint8Array.from(Buffer.from(new ArrayBuffer(500_000)));

const testFileRef = ref(storage, `${randomString()}/${randomString()}.txt`);

const uploadTask = uploadBytesResumable(testFileRef, someBytes);

Expand Down Expand Up @@ -68,8 +70,8 @@ describe('Storage', () => {

describe('useStorageDownloadURL', () => {
it('returns the same value as getDownloadURL', async () => {
const someBytes = Uint8Array.from(Buffer.from(new ArrayBuffer(1_000_000)));
const testFileRef = ref(storage, 'test-useStorageDownloadURL/testfile.txt');
const someBytes = Uint8Array.from(Buffer.from(new ArrayBuffer(500_000)));
const testFileRef = ref(storage, `${randomString()}/${randomString()}.txt`);

await uploadBytesResumable(testFileRef, someBytes);

Expand Down

0 comments on commit e4fd84e

Please sign in to comment.