loro/loro-js/tests/basic.test.ts
2023-11-07 19:48:16 +08:00

24 lines
553 B
TypeScript

import { describe, expect, it } from "vitest";
import {
ContainerID,
Loro,
setPanicHook,
} from "../src";
setPanicHook();
describe("list", () => {
it("insert containers", () => {
const doc = new Loro();
const list = doc.getList("list");
const map = list.insertContainer(0, "Map");
map.set("key", "value");
const v = list.get(0);
console.log(v);
expect(typeof v).toBe("string");
const m = doc.getMap(v as ContainerID);
expect(m.getDeepValue()).toStrictEqual({ key: "value" });
})
it.todo("iterate");
})