Skip to content

Commit a06eef2

Browse files
add failing tests
1 parent b9b544c commit a06eef2

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

test/manifest.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,6 +1553,44 @@ test('manifest - persist if manifest is updated', async function (t) {
15531553
}
15541554
})
15551555

1556+
test('manifest - writable', async function (t) {
1557+
const keyPair = crypto.keyPair()
1558+
1559+
const manifest = Verifier.createManifest({
1560+
quorum: 1,
1561+
signers: [
1562+
{
1563+
signature: 'ed25519',
1564+
publicKey: keyPair.publicKey
1565+
}
1566+
]
1567+
})
1568+
1569+
const key = Verifier.manifestHash(manifest)
1570+
const core = await create(t, { compat: false, manifest })
1571+
1572+
t.alike(core.key, key)
1573+
1574+
t.absent(core.keyPair)
1575+
t.absent(core.writable)
1576+
1577+
const signature = b4a.alloc(32)
1578+
await t.exception(core.append('hello'))
1579+
1580+
t.is(core.length, 0)
1581+
})
1582+
1583+
test('manifest - invalid signature fails', async function (t) {
1584+
const core = await create(t, { compat: false })
1585+
1586+
t.ok(core.writable)
1587+
1588+
const signature = b4a.alloc(32)
1589+
await t.exception(core.append('hello', { signature }))
1590+
1591+
t.is(core.length, 0)
1592+
})
1593+
15561594
function createMultiManifest(signers, prologue = null) {
15571595
return {
15581596
hash: 'blake2b',

0 commit comments

Comments
 (0)