import { describe, it } from 'node:test';
import { strict as assert } from 'node:assert';
import { htmlReferencesBundle } from '../BundleFreshness';
describe('htmlReferencesBundle', () => {
it('accepts the currently served Vite entry module', () => {
const html = '';
assert.equal(
htmlReferencesBundle(
html,
'https://dev.hivecast.ai/apps/director/assets/index-new.js',
'https://dev.hivecast.ai/apps/director/',
),
true,
);
});
it('accepts Vite dev HTML that imports the entrypoint from an inline module script', () => {
const html = '';
assert.equal(
htmlReferencesBundle(
html,
'https://local.hivecast.ai/apps/web/index.ts',
'https://local.hivecast.ai/apps/web/',
),
true,
);
});
it('rejects an older content-hashed bundle', () => {
const html = '';
assert.equal(
htmlReferencesBundle(
html,
'https://dev.hivecast.ai/apps/director/assets/index-old.js',
'https://dev.hivecast.ai/apps/director/',
),
false,
);
});
});