Skip to content

Commit

Permalink
Merge 269a3a8 into 589fcb0
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehardy authored Apr 27, 2021
2 parents 589fcb0 + 269a3a8 commit f9b81f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
18 changes: 8 additions & 10 deletions packages/database/e2e/reference/update.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ describe('database().ref().update()', function () {
}
});

it('throws if values does not contain any values', async function () {
try {
await firebase.database().ref(TEST_PATH).update({});
return Promise.reject(new Error('Did not throw an Error.'));
} catch (error) {
error.message.should.containEql("'values' must be an object containing multiple values");
return Promise.resolve();
}
});

it('throws if update paths are not valid', async function () {
try {
await firebase.database().ref(TEST_PATH).update({
Expand Down Expand Up @@ -83,6 +73,14 @@ describe('database().ref().update()', function () {
foo: value,
}),
);

await ref.update({}); // empty update should pass, but no side effects
const snapshot2 = await ref.once('value');
snapshot2.val().should.eql(
jet.contextify({
foo: value,
}),
);
});

it('callback if function is passed', async function () {
Expand Down
6 changes: 0 additions & 6 deletions packages/database/lib/DatabaseReference.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,6 @@ export default class DatabaseReference extends DatabaseQuery {
throw new Error("firebase.database().ref().update(*) 'values' must be an object.");
}

if (!Object.keys(values).length) {
throw new Error(
"firebase.database().ref().update(*) 'values' must be an object containing multiple values.",
);
}

const keys = Object.keys(values);
for (let i = 0; i < keys.length; i++) {
if (!isValidPath(keys[i])) {
Expand Down

0 comments on commit f9b81f9

Please sign in to comment.