mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-19 19:51:20 -08:00
test(refactor): [BASE-01] freeze published core and chapter baselines
This commit is contained in:
1 parent
7a5354e356
commit
1d705b3056
10 files changed
+454
-7
No files matched your search
@@ -0,0 +1,11 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { test } from 'node:test'
|
||||
import { hash, verifyIntegrity } from './releases.mjs'
|
||||
|
||||
test('release integrity rejects corrupted bytes and inconsistent frozen digests', () => {
|
||||
const bytes = Buffer.from('known release artifact')
|
||||
const release = { name: 'fixture', integrity: `sha512-${hash(bytes, 'sha512', 'base64')}`, sha256: hash(bytes) }
|
||||
assert.doesNotThrow(() => verifyIntegrity(bytes, release))
|
||||
assert.throws(() => verifyIntegrity(Buffer.from('replaced artifact'), release), /Integrity mismatch/)
|
||||
assert.throws(() => verifyIntegrity(bytes, { ...release, sha256: '0'.repeat(64) }), /Archive hash mismatch/)
|
||||
})
|
||||
Reference in new issue
Block a user