Skip to content

Commit

Permalink
failing test: loading empty doc from network
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffreylitt committed Aug 5, 2024
1 parent 373ce97 commit b5f2323
Show file tree
Hide file tree
Showing 2 changed files with 6,385 additions and 5,081 deletions.
16 changes: 16 additions & 0 deletions packages/automerge-repo/test/DocHandle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,22 @@ describe("DocHandle", () => {
assert.equal(doc?.foo, "bar")
})

it("should become ready if the network returns an empty document", async () => {
const handle = new DocHandle<TestDoc>(TEST_ID)

// we don't have it in storage, so we request it from the network
handle.request()

// simulate updating from the network with an empty document
handle.update(doc => {
return A.init()
})

const doc = await handle.doc()
assert.equal(handle.isReady(), true)
assert.deepEqual(doc, {})
})

it("should emit a change message when changes happen", async () => {
const handle = setup()

Expand Down
Loading

0 comments on commit b5f2323

Please sign in to comment.