Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

Commit

Permalink
fix: proper json output + remote deps
Browse files Browse the repository at this point in the history
Signed-off-by: Carson Farmer <carson.farmer@gmail.com>
  • Loading branch information
carsonfarmer committed Oct 22, 2020
1 parent 3e7cac8 commit a6b42d6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/local/collection.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { expect } from "chai";
import mingo from "mingo";
import { ulid } from "ulid";
import { Collection } from "./collection";
import { NewDexie } from "../utils";
Expand Down Expand Up @@ -330,7 +329,7 @@ describe("collection", function () {
// Should be an actual class instance, that we can export to JSON
if (personInstance) {
const json = personInstance.toJSON();
expect(json).to.equal(JSON.stringify(person));
expect(json).to.deep.equal(person);
} else {
throw new Error("should not be undefined");
}
Expand Down Expand Up @@ -508,8 +507,6 @@ describe("collection", function () {
expect(last?.age).to.be.greaterThan(5);
expect(last?.age).to.be.lessThan(56);
expect(await Person.find().count()).to.equal(7);
// Use mingo directly, should also return 3 (sanity check)
expect(mingo.find(people, query).count()).to.equal(3);
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/local/db.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Collection, CollectionConfig } from "./collection";
import { createIndexString, hashString, NewDexie } from "../utils";
import { createIndexString, NewDexie } from "../utils";
import { Remote } from "../remote";
import { Dexie, Table } from "dexie";

Expand Down
3 changes: 2 additions & 1 deletion src/local/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ export function DocumentInstanceClassFactory(
* Get a JSON representation of this instance.
*/
toJSON(): JSONType {
return JSON.stringify({ ...this });
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return { ...(this as any) };
}
};
return cls as DocumentInstanceConstructor;
Expand Down

0 comments on commit a6b42d6

Please sign in to comment.