import { describe, it, expect } from '@jest/globals' import { hash } from '../src/util' import { generateSimpleViteManifest } from './util' describe('Util', function () { describe('hash function', function () { it('computes the hash', function () { const manifest = generateSimpleViteManifest({ 'example.js': { imports: ['test.css'] }, 'test.css': { } }) expect(hash(manifest)).toEqual('2245696177') }) it('the hash changes when the manifest changes', function () { const manifest = generateSimpleViteManifest({ 'example.js': { imports: ['test.css'] }, 'test.css': { } }) const manifestChanged = generateSimpleViteManifest({ 'example.js': { imports: ['test1.css'] }, 'test1.css': { } }) expect(hash(manifest)).not.toEqual(hash(manifestChanged)) expect(hash(manifest)).toEqual('2245696177') expect(hash(manifestChanged)).toEqual('2547998666') }) }) })