Skip to content
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
22 changes: 22 additions & 0 deletions test/remote-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,28 @@ test('truncates by the writer result in the updated contiguous length being anno
t.is(getPeer(b, a).remoteContiguousLength, 1, 'truncate broadcast to other peers')
})

test.solo('remoteContiguousLength and remote contiguousLength match', async function (t) {
const a = await create(t)

await a.append(['a', 'b', 'c'])

const b = await create(t, a.key)

let d = 0
b.on('download', () => d++)

replicate(a, b, t)

await b.get(0)
await b.get(1)

while (b.contiguousLength !== a.remoteContiguousLength) {
await new Promise((resolve) => setTimeout(resolve, 20))
}

t.pass('contiguousLength matches remoteContiguousLength')
})

// Get peer b as seen by peer a (b is the remote peer).
function getPeer(a, b) {
for (const aPeer of a.core.replicator.peers) {
Expand Down
Loading