import fs from 'fs';
import path from 'path';
import { rewriteHTML } from './rewriteHTML';
import { publicFolder } from 'unleash-frontend';
const input = fs.readFileSync(path.join(publicFolder, 'index.html')).toString();
test('rewriteHTML substitutes meta tag with existing rewrite value', () => {
const result = rewriteHTML(input, '/hosted');
expect(
result.includes(''),
).toBe(true);
});
test('rewriteHTML substitutes meta tag with empty value', () => {
const result = rewriteHTML(input, '');
expect(result.includes('')).toBe(
true,
);
});
test('rewriteHTML substitutes asset paths correctly with baseUriPath', () => {
const result = rewriteHTML(input, '/hosted');
expect(
result.includes(
'',
),
).toBe(true);
});
test('rewriteHTML sets favicon path to root', () => {
const result = rewriteHTML(input, '');
expect(result.includes('')).toBe(
true,
);
});