fix(firestore): update isEqual API to check collection path equality (#3738)

* fix(firestore): update isEqual check

* test(firestore): test isEqual condition

Co-authored-by: Mike Diarmid <mike.diarmid@gmail.com>
[publish]
This commit is contained in:
Russell Wheatley
2020-06-03 13:57:07 +01:00
committed by GitHub
parent e6acaea7fa
commit 405e04009c
3 changed files with 13 additions and 1 deletions

View File

@@ -46,15 +46,26 @@ describe('firestore().collection().isEqual()', () => {
.collection('v6')
.limit(3);
const ref1 = firebase
.firestore()
.collection('foo')
.where('bar', '==', true);
const ref2 = firebase
.firestore()
.collection('baz')
.where('bar', '==', true);
const eql1 = query.isEqual(q1);
const eql2 = query.isEqual(q2);
const eql3 = query.isEqual(q3);
const eql4 = query.isEqual(q4);
const eql5 = ref1.isEqual(ref2);
eql1.should.be.False();
eql2.should.be.False();
eql3.should.be.False();
eql4.should.be.False();
eql5.should.be.False();
});
it('returns false when not equal (expensive checks)', () => {

View File

@@ -189,6 +189,7 @@ export default class FirestoreQuery {
this._modifiers.type !== other._modifiers.type ||
this._modifiers.filters.length !== other._modifiers.filters.length ||
this._modifiers.orders.length !== other._modifiers.orders.length ||
this._collectionPath.relativeName !== other._collectionPath.relativeName ||
Object.keys(this._modifiers.options).length !== Object.keys(other._modifiers.options).length
) {
return false;

View File

@@ -43,4 +43,4 @@
../packages/messaging/e2e/*.e2e.js
../packages/firestore/e2e/*.e2e.js
../packages/firestore/e2e/**/*.e2e.js