From 3bea8a99317427c295070d38d35b7da0bd19fae2 Mon Sep 17 00:00:00 2001 From: olav Date: Tue, 10 May 2022 15:47:54 +0200 Subject: [PATCH] refactor: use static as the asset dir name (#1586) * refactor: use static as the asset dir name * chore: update unleash-frontend * refactor: use the real index.html in tests --- package.json | 2 +- src/lib/util/rewriteHTML.test.ts | 37 ++++++-------------------------- src/lib/util/rewriteHTML.ts | 4 ++-- yarn.lock | 8 +++---- 4 files changed, 14 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index 308dd11392..852218e8e2 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,7 @@ "stoppable": "^1.1.0", "type-is": "^1.6.18", "@unleash/express-openapi": "^0.2.0", - "unleash-frontend": "4.11.0-beta.0", + "unleash-frontend": "4.11.0-beta.1", "uuid": "^8.3.2", "semver": "^7.3.5" }, diff --git a/src/lib/util/rewriteHTML.test.ts b/src/lib/util/rewriteHTML.test.ts index a2338cda96..efe5605794 100644 --- a/src/lib/util/rewriteHTML.test.ts +++ b/src/lib/util/rewriteHTML.test.ts @@ -1,32 +1,9 @@ +import fs from 'fs'; +import path from 'path'; import { rewriteHTML } from './rewriteHTML'; +import { publicFolder } from 'unleash-frontend'; -const input = ` - - - - - - - - - - - Unleash - - - - - - - -
- - - -`; +const input = fs.readFileSync(path.join(publicFolder, 'index.html')).toString(); test('rewriteHTML substitutes meta tag with existing rewrite value', () => { const result = rewriteHTML(input, '/hosted'); @@ -46,7 +23,7 @@ test('rewriteHTML substitutes asset paths correctly with baseUriPath', () => { const result = rewriteHTML(input, '/hosted'); expect( result.includes( - '