diff --git a/packages/firestore/src/model/document.ts b/packages/firestore/src/model/document.ts index ab2cf63569b..ff0b1266f33 100644 --- a/packages/firestore/src/model/document.ts +++ b/packages/firestore/src/model/document.ts @@ -141,6 +141,7 @@ export class NoDocument extends MaybeDocument { isEqual(other: MaybeDocument | null | undefined): boolean { return ( other instanceof NoDocument && + other.hasCommittedMutations === this.hasCommittedMutations && other.version.isEqual(this.version) && other.key.isEqual(this.key) ); diff --git a/packages/firestore/test/unit/local/local_store.test.ts b/packages/firestore/test/unit/local/local_store.test.ts index ebfec866c89..63ceed1e825 100644 --- a/packages/firestore/test/unit/local/local_store.test.ts +++ b/packages/firestore/test/unit/local/local_store.test.ts @@ -531,7 +531,7 @@ function genericLocalStoreTests( .toContain(deletedDoc('foo/bar', 0)) .afterAcknowledgingMutation({ documentVersion: 1 }) .toReturnRemoved('foo/bar') - .toContain(deletedDoc('foo/bar', 1)) + .toContain(deletedDoc('foo/bar', 1, { hasCommittedMutations: true })) .finish(); }); @@ -551,7 +551,7 @@ function genericLocalStoreTests( .afterReleasingQuery(query) .afterAcknowledgingMutation({ documentVersion: 2 }) .toReturnRemoved('foo/bar') - .toContain(deletedDoc('foo/bar', 2)) + .toContain(deletedDoc('foo/bar', 2, { hasCommittedMutations: true })) .finish() ); }); @@ -572,7 +572,7 @@ function genericLocalStoreTests( .afterReleasingQuery(query) .afterAcknowledgingMutation({ documentVersion: 2 }) .toReturnRemoved('foo/bar') - .toContain(deletedDoc('foo/bar', 2)) + .toContain(deletedDoc('foo/bar', 2, { hasCommittedMutations: true })) .finish() ); }); @@ -685,7 +685,7 @@ function genericLocalStoreTests( .toContain(deletedDoc('foo/bar', 0)) .afterAcknowledgingMutation({ documentVersion: 2 }) // delete mutation .toReturnRemoved('foo/bar') - .toContain(deletedDoc('foo/bar', 2)) + .toContain(deletedDoc('foo/bar', 2, { hasCommittedMutations: true })) .afterAcknowledgingMutation({ documentVersion: 3 }) // patch mutation .toReturnChanged(unknownDoc('foo/bar', 3)) .toContain(unknownDoc('foo/bar', 3)) diff --git a/packages/firestore/test/unit/model/mutation.test.ts b/packages/firestore/test/unit/model/mutation.test.ts index 690f377d3dd..528c95fdc6b 100644 --- a/packages/firestore/test/unit/model/mutation.test.ts +++ b/packages/firestore/test/unit/model/mutation.test.ts @@ -482,7 +482,9 @@ describe('Mutation', () => { ); const transformResult = new MutationResult(version(7), []); const docV7Unknown = unknownDoc('collection/key', 7); - const docV7Deleted = deletedDoc('collection/key', 7); + const docV7Deleted = deletedDoc('collection/key', 7, { + hasCommittedMutations: true + }); const docV7Committed = doc( 'collection/key', 7, diff --git a/packages/firestore/test/util/helpers.ts b/packages/firestore/test/util/helpers.ts index f0fdcf24909..a63fc29edc2 100644 --- a/packages/firestore/test/util/helpers.ts +++ b/packages/firestore/test/util/helpers.ts @@ -121,9 +121,10 @@ export function doc( export function deletedDoc( keyStr: string, - ver: TestSnapshotVersion + ver: TestSnapshotVersion, + options: DocumentOptions = {} ): NoDocument { - return new NoDocument(key(keyStr), version(ver)); + return new NoDocument(key(keyStr), version(ver), options); } export function unknownDoc(