Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix tests again
  • Loading branch information
abeisgoat committed May 10, 2021
commit ebea0984ec8eb198da02d3b00d3e1c16bf9742ae
15 changes: 9 additions & 6 deletions test/unit/storage/storage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,24 @@ describe('Storage', () => {
});
});

describe('Emulator mode', () => {
const EMULATOR_HOST = 'localhost:9199';
describe.only('Emulator mode', () => {
const VALID_EMULATOR_HOST = 'localhost:9199';
const INVALID_EMULATOR_HOST = 'https://localhost:9199';

before(() => {
beforeEach(() => {
delete process.env.STORAGE_EMULATOR_HOST;
process.env.FIREBASE_STORAGE_EMULATOR_HOST = EMULATOR_HOST;
delete process.env.FIREBASE_STORAGE_EMULATOR_HOST;
});

it('sets STORAGE_EMULATOR_HOST if FIREBASE_STORAGE_EMULATOR_HOST is set', () => {
process.env.FIREBASE_STORAGE_EMULATOR_HOST = VALID_EMULATOR_HOST;

new Storage(mockApp)
expect(process.env.STORAGE_EMULATOR_HOST).to.equal(`http://${EMULATOR_HOST}`);
expect(process.env.STORAGE_EMULATOR_HOST).to.equal(`http://${VALID_EMULATOR_HOST}`);
});

it('throws if FIREBASE_STORAGE_EMULATOR_HOST has a protocol', () => {
process.env.FIREBASE_STORAGE_EMULATOR_HOST = `https://${EMULATOR_HOST}`;
process.env.FIREBASE_STORAGE_EMULATOR_HOST = INVALID_EMULATOR_HOST;

expect(() => new Storage(mockApp)).to.throw(
'FIREBASE_STORAGE_EMULATOR_HOST should not contain a protocol');
Expand Down