You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: Likely not highly important to be fixed for the first release of Collections in Mixed.
When rebasing and thereby upgrading to Core 14.5.0, query tests that were passing in 14.0.1 (I know, apologies for the long version jump) are now failing.
There may have been some changes to expected behavior rather than bugs, but most of these tests pertain to queries using null. The assumed-to-be expected results are seen in each test case.
Actual Results
These tests are written to be more reproducible:
Using IN on dictionary keys:
it("dict - 'mixed.${key} IN $0, values'",function(this: RealmContext){// Using 'double' here as a non-null value, but the behavior of// these tests seems to be the same for all non-null primitives.constdictOfPrim={double: 2.5,nullValue: null};this.realm.write(()=>{// Create 1 object with a string as the mixed field.this.realm.create(MixedSchema.name,{mixed: "not a dictionary"});// Create 3 objects with a list of prims as the mixed field.this.realm.create(MixedSchema.name,{mixed: dictOfPrim});this.realm.create(MixedSchema.name,{mixed: dictOfPrim});this.realm.create(MixedSchema.name,{mixed: dictOfPrim});});constobjects=this.realm.objects(MixedSchema.name);expect(objects.length).equals(4);// ✅ Passes.letfiltered=objects.filtered(`mixed.double IN $0`,[2.5]);expect(filtered.length).equals(3);// 💥 Actual result: Returns 0 objects.filtered=objects.filtered(`mixed.double IN $0`,[2.5,null]);expect(filtered.length).equals(3);// ✅ Passes.filtered=objects.filtered(`mixed.nullValue IN $0`,[null]);expect(filtered.length).equals(3);// 💥 Actual result: Returns 0 objects.filtered=objects.filtered(`mixed.nullValue IN $0`,[2.5,null]);expect(filtered.length).equals(3);});it("dict of dict - 'mixed.nestedDict.${key} IN values'",function(this: RealmContext){// Using 'double' here as a non-null value, but the behavior of// these tests seems to be the same for all non-null primitives.constdictOfDictOfNull={nestedDict: {double: 2.5,nullValue: null}};this.realm.write(()=>{// Create 1 object with a string as the mixed field.this.realm.create(MixedSchema.name,{mixed: "not a dictionary"});// Create 3 objects with a list of prims as the mixed field.this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});});constobjects=this.realm.objects(MixedSchema.name);expect(objects.length).equals(4);// ✅ Passes.letfiltered=objects.filtered(`mixed.nestedDict.double IN $0`,[2.5]);expect(filtered.length).equals(3);// 💥 Actual result: Returns 1 object (the object whose mixed field is a string).filtered=objects.filtered(`mixed.nestedDict.double IN $0`,[2.5,null]);expect(filtered.length).equals(3);// 💥 Actual result: Returns 4 (all) objects.filtered=objects.filtered(`mixed.nestedDict.nullValue IN $0`,[null]);expect(filtered.length).equals(3);// 💥 Actual result: Returns 1 object (the object whose mixed field is a string).filtered=objects.filtered(`mixed.nestedDict.nullValue IN $0`,[2.5,null]);expect(filtered.length).equals(3);});
Lists - Matching null, using wildcards, using non-existent index:
it("list of list - 'mixed[0][0] == $0, null'",function(this: RealmContext){constlistOfListOfNull=[[null]];this.realm.write(()=>{// Create 1 object with a string as the mixed field.this.realm.create(MixedSchema.name,{mixed: "not a list"});// Create 3 objects with a list with null as the mixed field.this.realm.create(MixedSchema.name,{mixed: listOfListOfNull});this.realm.create(MixedSchema.name,{mixed: listOfListOfNull});this.realm.create(MixedSchema.name,{mixed: listOfListOfNull});});constobjects=this.realm.objects(MixedSchema.name);expect(objects.length).equals(4);// 💥 Actual result: Returns 4 (all) objects.constfiltered=objects.filtered(`mixed[0][0] == $0`,null);expect(filtered.length).equals(3);});it("list of list - 'mixed[0][${nonExistentIndex}] == $0, null'",function(this: RealmContext){constlistOfListOfNull=[[null]];constnonExistentIndex=1000;this.realm.write(()=>{// Create 1 object with a string as the mixed field.this.realm.create(MixedSchema.name,{mixed: "not a list"});// Create 3 objects with a list with null as the mixed field.this.realm.create(MixedSchema.name,{mixed: listOfListOfNull});this.realm.create(MixedSchema.name,{mixed: listOfListOfNull});this.realm.create(MixedSchema.name,{mixed: listOfListOfNull});});constobjects=this.realm.objects(MixedSchema.name);expect(objects.length).equals(4);// 💥 Actual result: Returns 1 object (the one where the mixed field is a string).constfiltered=objects.filtered(`mixed[0][${nonExistentIndex}] == $0`,null);expect(filtered.length).equals(0);});it("list of list - 'mixed[0][*] == $0, null'",function(this: RealmContext){constlistOfListOfNull=[[null]];this.realm.write(()=>{// Create 1 object with a string as the mixed field.this.realm.create(MixedSchema.name,{mixed: "not a list"});// Create 3 objects with a list with null as the mixed field.this.realm.create(MixedSchema.name,{mixed: listOfListOfNull});this.realm.create(MixedSchema.name,{mixed: listOfListOfNull});this.realm.create(MixedSchema.name,{mixed: listOfListOfNull});});constobjects=this.realm.objects(MixedSchema.name);expect(objects.length).equals(4);// 💥 Actual result: Returns 4 (all) objects.constfiltered=objects.filtered(`mixed[0][*] == $0`,null);expect(filtered.length).equals(3);});it("list of list - 'mixed[0][*].@type == 'null'",function(this: RealmContext){constlistOfListOfNull=[[null]];this.realm.write(()=>{// Create 1 object with a string as the mixed field.this.realm.create(MixedSchema.name,{mixed: "not a list"});// Create 3 objects with a list with null as the mixed field.this.realm.create(MixedSchema.name,{mixed: listOfListOfNull});this.realm.create(MixedSchema.name,{mixed: listOfListOfNull});this.realm.create(MixedSchema.name,{mixed: listOfListOfNull});});constobjects=this.realm.objects(MixedSchema.name);expect(objects.length).equals(4);// 💥 Actual result: Returns 4 (all) objects.constfiltered=objects.filtered(`mixed[0][*].@type == 'null'`);expect(filtered.length).equals(3);});it("list - 'mixed[${nonExistentIndex}][*] == $0, null'",function(this: RealmContext){constlistOfNull=[null];constnonExistentIndex=1000;this.realm.write(()=>{// Create 1 object with a string as the mixed field.this.realm.create(MixedSchema.name,{mixed: "not a list"});// Create 3 objects with a list with null as the mixed field.this.realm.create(MixedSchema.name,{mixed: listOfNull});this.realm.create(MixedSchema.name,{mixed: listOfNull});this.realm.create(MixedSchema.name,{mixed: listOfNull});});constobjects=this.realm.objects(MixedSchema.name);expect(objects.length).equals(4);// 💥 Actual result: Returns 4 (all) objects.constfiltered=objects.filtered(`mixed[${nonExistentIndex}][*] == $0`,null);expect(filtered.length).equals(0);});
Dictionaries - Matching null, using wildcards, using non-existent index:
it("dict of dict - 'mixed.nestedDict.${key} == $0, null'",function(this: RealmContext){constdictOfDictOfNull={nestedDict: {nullValue: null}};this.realm.write(()=>{// Create 1 object with a string as the mixed field.this.realm.create(MixedSchema.name,{mixed: "not a dictionary"});// Create 3 objects with a list with null as the mixed field.this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});});constobjects=this.realm.objects(MixedSchema.name);expect(objects.length).equals(4);// 💥 Actual result: Returns 4 (all) objects.letfiltered=objects.filtered(`mixed['nestedDict']['nullValue'] == $0`,null);expect(filtered.length).equals(3);// 💥 Actual result: Returns 4 (all) objects.filtered=objects.filtered(`mixed.nestedDict.nullValue == $0`,null);expect(filtered.length).equals(3);});it("dict of dict - 'mixed.nestedDict.${nonExistentKey} == $0, null'",function(this: RealmContext){constdictOfDictOfNull={nestedDict: {nullValue: null}};constnonExistentKey="nonExistentKey";this.realm.write(()=>{// Create 1 object with a string as the mixed field.this.realm.create(MixedSchema.name,{mixed: "not a dictionary"});// Create 3 objects with a list with null as the mixed field.this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});});constobjects=this.realm.objects(MixedSchema.name);expect(objects.length).equals(4);// 💥 Actual result: Returns 4 (all) objects.letfiltered=objects.filtered(`mixed['nestedDict']['${nonExistentKey}'] == $0`,null);expect(filtered.length).equals(3);// Missing keys are treated as 'null'.// 💥 Actual result: Returns 4 (all) objects.filtered=objects.filtered(`mixed.nestedDict.${nonExistentKey} == $0`,null);expect(filtered.length).equals(3);// Missing keys are treated as 'null'.});it("dict of dict - 'mixed.nestedDict[*] == $0, null'",function(this: RealmContext){constdictOfDictOfNull={nestedDict: {nullValue: null}};this.realm.write(()=>{// Create 1 object with a string as the mixed field.this.realm.create(MixedSchema.name,{mixed: "not a dictionary"});// Create 3 objects with a list with null as the mixed field.this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});});constobjects=this.realm.objects(MixedSchema.name);expect(objects.length).equals(4);// 💥 Actual result: Returns 4 (all) objects.constfiltered=objects.filtered(`mixed.nestedDict[*] == $0`,null);expect(filtered.length).equals(3);});it("dict of dict - 'mixed.nestedDict[*].@type == 'null''",function(this: RealmContext){constdictOfDictOfNull={nestedDict: {nullValue: null}};this.realm.write(()=>{// Create 1 object with a string as the mixed field.this.realm.create(MixedSchema.name,{mixed: "not a dictionary"});// Create 3 objects with a list with null as the mixed field.this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});this.realm.create(MixedSchema.name,{mixed: dictOfDictOfNull});});constobjects=this.realm.objects(MixedSchema.name);expect(objects.length).equals(4);// 💥 Actual result: Returns 4 (all) objects.constfiltered=objects.filtered(`mixed.nestedDict[*].@type == 'null'`);expect(filtered.length).equals(3);});
Core version
Core version: 14.5.0
The text was updated successfully, but these errors were encountered:
Expected results
Note: Likely not highly important to be fixed for the first release of Collections in Mixed.
When rebasing and thereby upgrading to Core 14.5.0, query tests that were passing in 14.0.1 (I know, apologies for the long version jump) are now failing.
There may have been some changes to expected behavior rather than bugs, but most of these tests pertain to queries using
null
. The assumed-to-be expected results are seen in each test case.Actual Results
These tests are written to be more reproducible:
Using IN on dictionary keys:
Lists - Matching
null
, using wildcards, using non-existent index:Dictionaries - Matching
null
, using wildcards, using non-existent index:Core version
Core version: 14.5.0
The text was updated successfully, but these errors were encountered: