From 90a8cad5d31ab3c83a8c2c1c57c11c66194d0928 Mon Sep 17 00:00:00 2001 From: Chris Manson Date: Wed, 3 Apr 2024 12:57:04 +0100 Subject: [PATCH] fix tests --- .../compat-exclude-dot-files-test.ts | 2 +- tests/scenarios/compat-namespaced-app-test.ts | 38 ++++++++++++++++--- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/tests/scenarios/compat-exclude-dot-files-test.ts b/tests/scenarios/compat-exclude-dot-files-test.ts index afa37a03fe..19478bb317 100644 --- a/tests/scenarios/compat-exclude-dot-files-test.ts +++ b/tests/scenarios/compat-exclude-dot-files-test.ts @@ -75,7 +75,7 @@ appScenarios // but not be picked up in the entrypoint expectAudit .module('./node_modules/.embroider/rewritten-app/index.html') - .resolves('./assets/app-template.js') + .resolves('./@embroider/core/entrypoint') .toModule() .withContents(content => { assert.notOk(/app-template\/\.foobar/.test(content), '.foobar is not in the entrypoint'); diff --git a/tests/scenarios/compat-namespaced-app-test.ts b/tests/scenarios/compat-namespaced-app-test.ts index 27af7183ca..54b53e62aa 100644 --- a/tests/scenarios/compat-namespaced-app-test.ts +++ b/tests/scenarios/compat-namespaced-app-test.ts @@ -41,10 +41,10 @@ appScenarios expectFile = expectRewrittenFilesAt(app.dir, { qunit: assert }); }); - test(`imports within app js`, function () { + test(`imports within app js`, function (assert) { expectAudit .module('./node_modules/.embroider/rewritten-app/index.html') - .resolves('./assets/@ef4/namespaced-app.js') + .resolves('./@embroider/core/entrypoint') .toModule() .resolves('./-embroider-implicit-modules.js') .toModule() @@ -53,10 +53,36 @@ appScenarios expectAudit .module('./node_modules/.embroider/rewritten-app/index.html') - .resolves('./assets/@ef4/namespaced-app.js') - .toModule().codeContains(`d("@ef4/namespaced-app/templates/application", function () { - return i("@ef4/namespaced-app/templates/application.hbs"); - });`); + .resolves('./@embroider/core/entrypoint') + .toModule() + .withContents(contents => { + const results = + /import \* as (\w+) from "@embroider-dep\/@ef4\/namespaced-app\/templates\/application.hbs"/.exec( + contents + ); + + if (!results || !results[1]) { + return false; + } + + assert.codeContains( + contents, + `d("@ef4/namespaced-app/templates/application", function () { + return ${results[1]}; + });` + ); + + return true; + }); + + // .codeContains(`d("@ef4/namespaced-app/templates/application", function () { + // return i("@ef4/namespaced-app/templates/application.hbs"); + // });`); + + // import * as amdModule16 from "@embroider-dep/@ef4/namespaced-app/templates/application.hbs"; + // d("@ef4/namespaced-app/templates/application", function () { + // return amdModule16; + // }); }); test(`app css location`, function () {