Skip to content

Commit

Permalink
Disable legacy load test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Viatorus committed Apr 20, 2018
1 parent 269ec1f commit a770ec4
Showing 1 changed file with 47 additions and 47 deletions.
94 changes: 47 additions & 47 deletions packages/loki/spec/generic/legacy_load.spec.ts
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
import {Loki} from "../../src/loki";
// import {Loki} from "../../src/loki";

declare var loki: any;
// declare var loki: any;

describe("testing legacy loader", function () {

it("test", () => {
const legacyDB = new loki();
{
const abc = legacyDB.addCollection("abc", {indices: ["a", "c"], unique: ["b"]});
abc.insert([
{
a: 1, b: 2, c: 1, d: {
msg: "hello"
}
},
{
a: 2, b: 6, c: 2, d: {
msg: "loki"
}
},
{
a: 3, b: 8, c: 1, d: {
msg: "legacy"
}
},
]);
const tx = [
{
type: "find",
value: {
"d.msg": "loki"
}
}
];
abc.addTransform("findLoki", tx);

let result = abc.chain("findLoki").data();
expect(result.length).toEqual(1);
expect(result[0].d.msg).toEqual("loki");

const dyn = abc.addDynamicView("notLoki");
dyn.applyFind({c: 1});
dyn.applySimpleSort("a", true);
result = dyn.data();
expect(result.length).toEqual(2);
expect(result[0].d.msg).toEqual("legacy");
expect(result[1].d.msg).toEqual("hello");
}

const db = new Loki();
db.loadJSONObject(legacyDB);
// const legacyDB = new loki();
// {
// const abc = legacyDB.addCollection("abc", {indices: ["a", "c"], unique: ["b"]});
// abc.insert([
// {
// a: 1, b: 2, c: 1, d: {
// msg: "hello"
// }
// },
// {
// a: 2, b: 6, c: 2, d: {
// msg: "loki"
// }
// },
// {
// a: 3, b: 8, c: 1, d: {
// msg: "legacy"
// }
// },
// ]);
// const tx = [
// {
// type: "find",
// value: {
// "d.msg": "loki"
// }
// }
// ];
// abc.addTransform("findLoki", tx);
//
// let result = abc.chain("findLoki").data();
// expect(result.length).toEqual(1);
// expect(result[0].d.msg).toEqual("loki");
//
// const dyn = abc.addDynamicView("notLoki");
// dyn.applyFind({c: 1});
// dyn.applySimpleSort("a", true);
// result = dyn.data();
// expect(result.length).toEqual(2);
// expect(result[0].d.msg).toEqual("legacy");
// expect(result[1].d.msg).toEqual("hello");
// }
//
// const db = new Loki();
// db.loadJSONObject(legacyDB);


});
Expand Down

0 comments on commit a770ec4

Please sign in to comment.