Skip to content

Commit fea8b4a

Browse files
committed
test: verify that in pro phoenix-pro extension is loaded only from minified files
1 parent 1ae6ca3 commit fea8b4a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/extensionsIntegrated/phoenix-pro/unit-tests/LivePreviewEdit-test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,24 @@ define(function (require, exports, module) {
214214
await endPreviewSession();
215215
}, 30000);
216216

217+
it("should phoenix-pro source files should not be loaded in prod dist builds", async function () {
218+
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]),
219+
"SpecRunnerUtils.openProjectFiles simple1.html");
220+
221+
await waitsForLiveDevelopmentToOpen();
222+
const loadedProScripts = Array.from(testWindow.document.scripts)
223+
.map(s => s.src)
224+
.filter(src => src && src.includes('extensionsIntegrated/phoenix-pro'));
225+
if(testWindow.Phoenix.config.environment === 'production'){
226+
// in production all code should be loaded from minified files
227+
expect(loadedProScripts.length).toBe(0);
228+
} else {
229+
// in development all code should be loaded from source files
230+
expect(loadedProScripts.length).toBeGreaterThan(0);
231+
}
232+
await endPreviewSession();
233+
}, 30000);
234+
217235
async function forRemoteExec(script, compareFn) {
218236
let result;
219237
await awaitsFor(

0 commit comments

Comments
 (0)