Skip to content

Commit

Permalink
Changed default Firebase return value to undefined (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorbascrumps authored and nicolodavis committed Feb 12, 2019
1 parent 83f0c74 commit 87d1e5b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/server/db/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ export class Firebase {
this.cache.set(id, doc);
}

if (doc === null) {
return undefined;
}

return doc;
}

Expand Down
4 changes: 2 additions & 2 deletions src/server/db/firebase.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('Firestore', async () => {

test('must return undefined when no game exists', async () => {
const state = await db.get('gameID');
expect(state).toEqual(null);
expect(state).toEqual(undefined);
});

test('cache hit', async () => {
Expand Down Expand Up @@ -158,7 +158,7 @@ describe('RTDB', async () => {

test('must return undefined when no game exists', async () => {
const state = await db.get('gameID');
expect(state).toEqual(null);
expect(state).toEqual(undefined);
});

test('cache hit', async () => {
Expand Down

0 comments on commit 87d1e5b

Please sign in to comment.