Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failing test: loading empty doc from network #369

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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