✅ Fix query unit tests + Bump package_info_plus package#803
✅ Fix query unit tests + Bump package_info_plus package#803istornz wants to merge 6 commits intoappwrite:masterfrom
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.
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.
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.
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
stnguyen90
left a comment
There was a problem hiding this comment.
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.
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? |
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']].