Skip to content

Commit

Permalink
Small corrections to queries
Browse files Browse the repository at this point in the history
  • Loading branch information
papafe committed Jun 14, 2023
1 parent 146a193 commit a1bfbce
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions integration-tests/tests/src/tests/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,25 +133,6 @@ class PointOfInterest extends Realm.Object implements IPointOfInterest {
};
}

interface ICompany {
id: number;
locations: MyGeoPoint[];
}

class Company extends Realm.Object implements ICompany {
id = 0;
locations: [MyGeoPoint] = [new MyGeoPoint(0, 0)];

static schema: ObjectSchema = {
name: "Company",
properties: {
id: "int",
locations: "MyGeoPoint[]",
},
primaryKey: "id",
};
}

type QueryLengthPair = [ExpectedLength: number, Query: string, ...QueryArgs: Array<any>];
type QueryExceptionPair = [ExpectedException: string, Query: string, ...QueryArgs: Array<any>];
type QueryResultsPair = [ExpectedResults: any[], Query: string, ...QueryArgs: Array<any>];
Expand Down Expand Up @@ -209,7 +190,7 @@ const expectQueryResultValues = (
queryResultPairs.forEach(([expectedResults, queryString, ...queryArgs]) => {
let results = realm.objects<any>(objectSchema);
results = results.filtered(queryString, ...queryArgs);
console.log(results.map((el) => el[propertyToCompare])); //TODO For testing, can be removed later
//console.log(results.map((el) => el[propertyToCompare])); //TODO For testing, can be removed later
expect(results.length).to.equal(expectedResults.length);
expect(results.map((el) => el[propertyToCompare])).to.deep.equal(
expectedResults,
Expand All @@ -222,7 +203,7 @@ const expectQueryResultValues = (

describe("Queries", () => {
describe.only("GeoSpatial", () => {
openRealmBeforeEach({ schema: [PointOfInterest, Company, MyGeoPoint.schema] });
openRealmBeforeEach({ schema: [PointOfInterest, MyGeoPoint.schema] });
const zero: IPointOfInterest = {
id: 1,
location: new MyGeoPoint(0, 0),
Expand Down Expand Up @@ -736,16 +717,6 @@ describe("Queries", () => {
]);
});

//TODO Need to re-enable when we know if we can do this or not
it.skip("Box around north pole", function (this: RealmContext) {
const box: GeoBox = {
bottomLeft: [6, 89],
topRight: [160, 89],
};

geoTest(this.realm, box, [northPole]);
});

it("Circle around north pole", function (this: RealmContext) {
const circle: GeoCircle = {
center: [0, 90],
Expand Down

0 comments on commit a1bfbce

Please sign in to comment.