-
Notifications
You must be signed in to change notification settings - Fork 138
Unit tests for data equality comparison #992
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
Conversation
|
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-ivm
@tanstack/electric-db-collection
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Size Change: 0 B Total Size: 88.2 kB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 3.35 kB ℹ️ View Unchanged
|
samwillis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests look good, but unsure about the package.json and pnpm-lock change?
Approving for when you address that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this leaked in from another branch, or due to where you branched off?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wouldn't compile for me. I assumed it is due to renovate having upgraded something and now requiring this package explicitly.
Added some unit tests to check whether
eqworks properly on Dates because according to #934 dates are compared by reference instead of by value. However, the tests seem to indicate that the dates are being compared by value and thus are working as expected.Looking at the code, we do normalize the values before comparing them:
db/packages/db/src/query/compiler/evaluators.ts
Lines 165 to 178 in 7aedf12
The normalization transforms dates into epoch numbers:
db/packages/db/src/utils/comparison.ts
Lines 142 to 145 in 7aedf12