import { removeHtmlEntryScript } from '../src/index'; describe('vite-plugin-index-html', () => { test('remove-html-entry-script', () => { const html = ` icestark
` expect(removeHtmlEntryScript('/Users/ice', html, '/icestark-demo/ice-vite/child/src/app')).toBe(html) }) test('remove-html-entry-script-vite/src-irregular', () => { const html = ` Vite App
` const result = html.replace('', ''); expect(removeHtmlEntryScript('/Users/ice', html, '/icestark-demo/src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, 'icestark-demo/src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, './icestark-demo/src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, '/src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, './src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, 'src/main.tsx')).toBe(result) }) test('remove-html-entry-script-vite/src-relative-A', () => { const html = ` Vite App
` const result = html.replace('', ''); expect(removeHtmlEntryScript('/Users/ice', html, '/icestark-demo/src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, 'icestark-demo/src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, './icestark-demo/src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, '/src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, './src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, 'src/main.tsx')).toBe(result) }) test('remove-html-entry-script-vite/src-relative-B', () => { const html = ` Vite App
` const result = html.replace('', ''); expect(removeHtmlEntryScript('/Users/ice', html, '/icestark-demo/src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, 'icestark-demo/src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, './icestark-demo/src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, '/src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, './src/main.tsx')).toBe(result) expect(removeHtmlEntryScript('/Users/ice', html, 'src/main.tsx')).toBe(result) }) });