mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-23 03:59:18 +08:00
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:
@@ -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)', () => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -43,4 +43,4 @@
|
||||
|
||||
../packages/messaging/e2e/*.e2e.js
|
||||
|
||||
../packages/firestore/e2e/*.e2e.js
|
||||
../packages/firestore/e2e/**/*.e2e.js
|
||||
|
||||
Reference in New Issue
Block a user