Skip to content

Add hasCommittedMutations to NoDocument equals #1245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/firestore/src/model/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Expand Down
8 changes: 4 additions & 4 deletions packages/firestore/test/unit/local/local_store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand All @@ -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()
);
});
Expand All @@ -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()
);
});
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 3 additions & 1 deletion packages/firestore/test/unit/model/mutation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions packages/firestore/test/util/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down