Skip to content

Commit c59a07c

Browse files
author
Mauve Signweaver
committed
test: Ensure core writable is reopened with URL
1 parent ae89da3 commit c59a07c

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,4 +331,28 @@ test('Get a hyperbee and share a key value pair', async (t) => {
331331
}
332332
})
333333

334+
test.solo('Load URL of created core is writable', async (t) => {
335+
const data = 'Hello World!'
336+
337+
const storage = await tmp()
338+
339+
const sdk = await create({ storage })
340+
341+
try {
342+
const core = await sdk.get('example')
343+
t.is(core.writable, true)
344+
await core.append(data)
345+
const {url, id} = core
346+
await core.close()
347+
348+
const reloadedCore = await sdk.get(url)
349+
t.not(reloadedCore, core, 'new core created')
350+
t.is(reloadedCore.url, url, 'same url')
351+
t.is(reloadedCore.writable, true, 'can still write')
352+
353+
} finally {
354+
await sdk.close()
355+
}
356+
})
357+
334358
// test('', async (t) => {})

0 commit comments

Comments
 (0)