Skip to content

Adding isEqual to the public API #140

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 12 commits into from
Feb 26, 2018
Merged

Adding isEqual to the public API #140

merged 12 commits into from
Feb 26, 2018

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Feb 17, 2018

This adds isEquals to all out public API types, ignoring metadata for all *Snapshots.

The API is mostly a port from Web, with the addition of an isEqulas for WriteResult and DocumentChange.

There are also some changes to QueryDocumentSnapshot to make equals more efficient when not all changes are materialized yet.

@ghost ghost added the cla: yes This human has signed the Contributor License Agreement. label Feb 17, 2018
@codecov
Copy link

codecov bot commented Feb 17, 2018

Codecov Report

Merging #140 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #140   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines        1688   1728   +40     
=====================================
+ Hits         1688   1728   +40
Impacted Files Coverage Δ
src/watch.js 100% <ø> (ø) ⬆️
src/path.js 100% <100%> (ø) ⬆️
src/document.js 100% <100%> (ø) ⬆️
src/reference.js 100% <100%> (ø) ⬆️
src/field-value.js 100% <100%> (ø) ⬆️
src/write-batch.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 25067bb...9f40d37. Read the comment docs.

@schmidt-sebastian schmidt-sebastian changed the base branch from master to testcoverage February 17, 2018 15:48
@schmidt-sebastian schmidt-sebastian changed the base branch from testcoverage to master February 17, 2018 18:34
Copy link
Contributor

@mikelehen mikelehen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some optional nits.

src/document.js Outdated
this === other ||
(is.instance(other, DocumentSnapshot) &&
this._ref.isEqual(other._ref) &&
deepEqual(this._fieldsProto, other._fieldsProto))

This comment was marked as spam.

This comment was marked as spam.

src/path.js Outdated
isEqual(other) {
return (
this === other ||
(is.instanceof(other, Path) && this.compareTo(other) === 0)

This comment was marked as spam.

This comment was marked as spam.

@@ -106,6 +106,20 @@ class WriteResult {
get writeTime() {
return this._writeTime;
}

/**
* Returns true if this `WriteResult` is equal to the provided value.

This comment was marked as spam.

@@ -142,4 +142,12 @@ describe('Collection interface', function() {
assert.ok(documentRef.id.length, 20);
});
});

it('has equals() method', function() {

This comment was marked as spam.

This comment was marked as spam.

@schmidt-sebastian schmidt-sebastian merged commit f23c167 into master Feb 26, 2018
@ghost ghost removed the cla: yes This human has signed the Contributor License Agreement. label Feb 26, 2018
@schmidt-sebastian schmidt-sebastian deleted the equals branch June 26, 2018 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants