21 行
632 B
TypeScript
21 行
632 B
TypeScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
|
|
import { computeFingerprint } from '../src/fingerprint'
|
|
|
|
test('fingerprint uses common SHA-256 and normalizes volatile identifiers', () => {
|
|
const first = computeFingerprint(
|
|
'error',
|
|
'request 123456 failed for aabbccddeeff00112233445566778899',
|
|
'Error\n at first (a.ts:1)\n at second (b.ts:2)',
|
|
)
|
|
const second = computeFingerprint(
|
|
'error',
|
|
'request 987654 failed for 00112233445566778899aabbccddeeff',
|
|
'Error\n at first (a.ts:1)\n at second (b.ts:2)',
|
|
)
|
|
|
|
assert.equal(first, second)
|
|
assert.match(first, /^[a-f0-9]{64}$/)
|
|
})
|