import { describe, expect, it } from 'vitest'; import { compareReimportSourceHashes } from '../../src/domain/reimport-source'; describe('exact reimport source identity', () => { const first = 'a'.repeat(64); const second = 'b'.repeat(64); it('matches only the exact SHA-256 multiset independent of file order', () => { expect(compareReimportSourceHashes([first, second], [second, first])).toBe('match'); expect(compareReimportSourceHashes([first, second], [first])).toBe('mismatch'); expect(compareReimportSourceHashes([first, second], [first, 'c'.repeat(64)])).toBe('mismatch'); expect(compareReimportSourceHashes([first, first], [first, second])).toBe('mismatch'); }); it('fails closed when the original scan has no complete hash evidence', () => { expect(compareReimportSourceHashes([], [first])).toBe('reference-unavailable'); expect(compareReimportSourceHashes([undefined], [first])).toBe('reference-unavailable'); }); });