-
Notifications
You must be signed in to change notification settings - Fork 173
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
✅ Fix query unit tests + Bump package_info_plus package #803
base: master
Are you sure you want to change the base?
Conversation
@istornz, also why do these tests need to be reworked? |
Because tests was broken & can't compile/run |
final query = jsonDecode(Query.notEqual('attr', ['a', 'b', 'c'])); | ||
print(query); | ||
expect(query['attribute'], 'attr'); | ||
expect(query['values'], [['a', 'b', 'c']]); // Is there a bug here? |
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.
Hmm I think the idea with this was that you'd never pass a list to this because it just doesn't make sense.
attr != a OR attr != b OR attr != C
would always be true.
That said, the implementation makes the behavior weird... @lohanidamodar, what do you think?
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.
I think it's the database implementation, we don't support arrays for values in few methods. @abnegate might be able to shed some light.
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.
Not equal should only provide a single value, the problem is it's hard to represent in languages without union types. This should actually throw an exception
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.
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.
Please also try to run the tests locally to make sure it all passes.
|
||
test('with a list', () { | ||
final query = jsonDecode(Query.notEqual('attr', ['a', 'b', 'c'])); | ||
print(query); |
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.
Please make sure to delete all the print statement
final query = jsonDecode(Query.notEqual('attr', ['a', 'b', 'c'])); | ||
print(query); | ||
expect(query['attribute'], 'attr'); | ||
expect(query['values'], [['a', 'b', 'c']]); // Is there a bug here? |
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.
What does this PR do?
Rework query unit tests.
Upgrade package_info_plus dep to 5.0.1 (as is blocking on some project depending on it)
I think the correct behavior is to return a simple list ['a', 'b', 'c'] like others but actually it return [['a', 'b', 'c']].