-
Notifications
You must be signed in to change notification settings - Fork 0
/
issues.spec.mjs
42 lines (39 loc) · 1.05 KB
/
issues.spec.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import Automerge from "@livingspec/automerge-wasm";
import { expect } from "chai";
describe("text issues", () => {
context("text field with less that 63", () => {
it("should show wrens", () => {
expect(
toJs(
Automerge.from({
birds: {
magpies: 4,
text: new Automerge.Text(new Array(63).fill("a")),
wrens: 3,
},
})
)
).to.have.nested.property("birds.wrens");
});
});
context("text field with more that 63", () => {
[1, 28, 63, 64, 100, 127, 128, 191, 192, 256, 383, 384, 511, 512].forEach(length => {
it("should show wrens", () => {
expect(
toJs(
Automerge.from({
birds: {
magpies: 4,
test: new Automerge.Text(new Array(length).fill('a')),
wrens: 3,
},
})
)
).to.have.nested.property("birds.wrens");
});
});
});
function toJs(doc) {
return JSON.parse(JSON.stringify(doc));
}
});