Skip to content

Commit

Permalink
feat: use v0.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
zxch3n committed Dec 5, 2023
1 parent 8bfe24b commit afbf996
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 108 deletions.
2 changes: 1 addition & 1 deletion 01_basic.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Loro, LoroList, LoroMap } from "npm:loro-crdt@0.5.0"
import { Loro, LoroList, LoroMap } from "npm:loro-crdt@0.6.3"
import { expect } from "npm:[email protected]"

Deno.test("Basic usage", () => {
Expand Down
5 changes: 3 additions & 2 deletions 02_text.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Delta, Loro } from "npm:loro-crdt@0.5.0";
import { Delta, Loro } from "npm:loro-crdt@0.6.3";
import { expect } from "npm:[email protected]";

Deno.test("Text", () => {
Expand Down Expand Up @@ -71,7 +71,7 @@ Deno.test("Rich text custom expand behavior - Link", () => {
}] as Delta<string>[]);
})

Deno.test("Rich text event", () => {
Deno.test("Rich text event", async () => {
/**
* Loro text will receive rich text event in Quill Delta format
*/
Expand All @@ -91,5 +91,6 @@ Deno.test("Rich text event", () => {
});
text.mark({ start: 0, end: 5 }, "bold", true);
doc.commit();
await new Promise((resolve) => setTimeout(resolve, 0));
expect(ran).toBeTruthy();
});
2 changes: 1 addition & 1 deletion 03_version.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Loro, OpId } from "npm:loro-crdt@0.5.0";
import { Loro, OpId } from "npm:loro-crdt@0.6.3";
import { expect } from "npm:[email protected]";


Expand Down
2 changes: 1 addition & 1 deletion 04_time_travel.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Loro } from "npm:loro-crdt@0.5.0";
import { Loro } from "npm:loro-crdt@0.6.3";
import { expect } from "npm:[email protected]";

Deno.test("Time Travel", () => {
Expand Down
2 changes: 1 addition & 1 deletion 05_save_and_load.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Loro } from "npm:loro-crdt@0.5.0";
import { Loro } from "npm:loro-crdt@0.6.3";
import { expect } from "npm:[email protected]";

Deno.test("Save and load", () => {
Expand Down
28 changes: 28 additions & 0 deletions 06_event.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Loro, LoroText, getType } from "npm:[email protected]";
import { expect } from "npm:[email protected]";

Deno.test("Event have delta that contains Container", async () => {
const doc = new Loro();
const list = doc.getList("list");
let ran = false;
doc.subscribe(event => {
if (event.diff.type === "list") {
for (const item of event.diff.diff) {
expect(item.insert?.length).toBe(2);
expect(getType(item.insert![0])).toBe("Text")
expect(getType(item.insert![1])).toBe("Map")
const t = item.insert![0] as LoroText;
expect(t.toString()).toBe("Hello")
}
ran = true;
}
})

list.insertContainer(0, "Map");
const t = list.insertContainer(0, "Text");
t.insert(0, "He");
t.insert(2, "llo");
doc.commit();
await new Promise(resolve => setTimeout(resolve, 1));
expect(ran).toBeTruthy()
})
2 changes: 1 addition & 1 deletion benches/text.bench.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Loro } from "npm:loro-crdt@0.4.0"
import { Loro } from "npm:loro-crdt@0.6.3"

/**
cpu: Apple M1
Expand Down
121 changes: 20 additions & 101 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit afbf996

Please sign in to comment.