Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx authored Mar 19, 2024
1 parent 54344ba commit 6741221
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/core/__tests__/transform/rewrite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,30 @@ describe('Transform: rewriteModule', () => {
});

describe('ember-template-imports', () => {
test('in class extends', () => {
let customEnv = GlintEnvironment.load(['ember-loose', 'ember-template-imports']);
let script = {
filename: 'test.gts',
contents: stripIndent`
import Component, { hbs } from 'special/component';
export default class MyComponent extends Component(<template></template>) {
}
`,
};

let transformedModule = rewriteModule(ts, { script }, customEnv);


expect(transformedModule?.transformedContents).toMatchInlineSnapshot(`
"import Component, { hbs } from 'special/component';
export default class MyComponent extends Component(({} as typeof import(\\"@glint/environment-ember-template-imports/-private/dsl\\")).templateExpression(function(𝚪, χ: typeof import(\\"@glint/environment-ember-template-imports/-private/dsl\\")) {
𝚪; χ;
})) {
}"
`);
});
test('embedded gts templates', () => {
let customEnv = GlintEnvironment.load(['ember-loose', 'ember-template-imports']);
let script = {
Expand Down

0 comments on commit 6741221

Please sign in to comment.