Skip to content

Commit 4bdfc66

Browse files
committed
Update snapshots
1 parent 955e4a4 commit 4bdfc66

File tree

1 file changed

+68
-68
lines changed

1 file changed

+68
-68
lines changed

test-packages/package-test-core/__tests__/transform/rewrite.test.ts

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -501,50 +501,6 @@ describe('Transform: rewriteModule', () => {
501501
`);
502502
});
503503

504-
test('handles satisfies', () => {
505-
const emberTemplateImportsEnvironment = GlintEnvironment.load(['ember-template-imports']);
506-
507-
let script = {
508-
filename: 'test.gts',
509-
contents: [
510-
`import type { TOC } from '@ember/component/template-only';`,
511-
``,
512-
`const SmolComp = `,
513-
` <template>`,
514-
` Hello there, {{@name}}`,
515-
` </template> satisfies TOC<{ Args: { name: string }}>;`,
516-
``,
517-
`<template>`,
518-
` <SmolComp @name="Ember" />`,
519-
`</template> satisfies TOC<{ Args: {}, Blocks: {}, Element: null }>`,
520-
``,
521-
].join('\n'),
522-
};
523-
524-
let transformedModule = rewriteModule(ts, { script }, emberTemplateImportsEnvironment);
525-
526-
expect(transformedModule?.errors?.length).toBe(0);
527-
expect(transformedModule?.transformedContents).toMatchInlineSnapshot(`
528-
"import type { TOC } from '@ember/component/template-only';
529-
530-
const SmolComp =
531-
({} as typeof import("@glint/environment-ember-template-imports/-private/dsl")).templateExpression(function(__glintRef__, __glintDSL__: typeof import("@glint/environment-ember-template-imports/-private/dsl")) {
532-
__glintDSL__.emitContent(__glintDSL__.resolveOrReturn(__glintRef__.args.name)());
533-
__glintRef__; __glintDSL__;
534-
}) satisfies TOC<{ Args: { name: string }}>;
535-
536-
export default ({} as typeof import("@glint/environment-ember-template-imports/-private/dsl")).templateExpression(function(__glintRef__, __glintDSL__: typeof import("@glint/environment-ember-template-imports/-private/dsl")) {
537-
{
538-
const __glintY__ = __glintDSL__.emitComponent(__glintDSL__.resolve(SmolComp)({
539-
name: "Ember", ...__glintDSL__.NamedArgsMarker }));
540-
__glintY__;
541-
}
542-
__glintRef__; __glintDSL__;
543-
}) satisfies TOC<{ Args: {}, Blocks: {}, Element: null }>
544-
"
545-
`);
546-
});
547-
548504
test('embedded gts templates', () => {
549505
let customEnv = GlintEnvironment.load(['ember-loose', 'ember-template-imports']);
550506
let script = {
@@ -935,31 +891,75 @@ __glintRef__; __glintDSL__;
935891
`);
936892
});
937893

938-
test('with implicit export default and satisfies', () => {
939-
let customEnv = GlintEnvironment.load(['ember-loose', 'ember-template-imports']);
940-
let script = {
941-
filename: 'test.gts',
942-
contents: stripIndent`
943-
import type { TOC } from '@ember/component/template-only';
944-
<template>HelloWorld!</template> satisfies TOC<{
894+
describe('satisfies', () => {
895+
test('with implicit export default', () => {
896+
let customEnv = GlintEnvironment.load(['ember-loose', 'ember-template-imports']);
897+
let script = {
898+
filename: 'test.gts',
899+
contents: stripIndent`
900+
import type { TOC } from '@ember/component/template-only';
901+
<template>HelloWorld!</template> satisfies TOC<{
902+
Blocks: { default: [] }
903+
}>;
904+
`,
905+
};
906+
907+
let transformedModule = rewriteModule(ts, { script }, customEnv);
908+
909+
expect(transformedModule?.errors).toEqual([]);
910+
expect(transformedModule?.transformedContents).toMatchInlineSnapshot(`
911+
"import type { TOC } from '@ember/component/template-only';
912+
export default ({} as typeof import("@glint/environment-ember-template-imports/-private/dsl")).templateExpression(function(__glintRef__, __glintDSL__: typeof import("@glint/environment-ember-template-imports/-private/dsl")) {
913+
__glintRef__; __glintDSL__;
914+
}) satisfies TOC<{
945915
Blocks: { default: [] }
946-
}>;
947-
`,
948-
};
949-
950-
let transformedModule = rewriteModule(ts, { script }, customEnv);
951-
952-
expect(transformedModule?.errors).toEqual([]);
953-
expect(transformedModule?.transformedContents).toMatchInlineSnapshot(`
954-
"import __GLINT_GTS_EXTENSION_HACK__ from './__glint-non-existent.gts';
955-
import __GLINT_GJS_EXTENSION_HACK__ from './__glint-non-existent.gjs';
956-
import type { TOC } from '@ember/component/template-only';
957-
export default ({} as typeof import("@glint/environment-ember-template-imports/-private/dsl")).templateExpression(function(__glintRef__, __glintDSL__: typeof import("@glint/environment-ember-template-imports/-private/dsl")) {
958-
__glintRef__; __glintDSL__;
959-
}) satisfies TOC<{
960-
Blocks: { default: [] }
961-
}>;"
962-
`);
916+
}>;"
917+
`);
918+
});
919+
920+
test('with two template-only components', () => {
921+
const emberTemplateImportsEnvironment = GlintEnvironment.load(['ember-template-imports']);
922+
923+
let script = {
924+
filename: 'test.gts',
925+
contents: [
926+
`import type { TOC } from '@ember/component/template-only';`,
927+
``,
928+
`const SmolComp = `,
929+
` <template>`,
930+
` Hello there, {{@name}}`,
931+
` </template> satisfies TOC<{ Args: { name: string }}>;`,
932+
``,
933+
`<template>`,
934+
` <SmolComp @name="Ember" />`,
935+
`</template> satisfies TOC<{ Args: {}, Blocks: {}, Element: null }>`,
936+
``,
937+
].join('\n'),
938+
};
939+
940+
let transformedModule = rewriteModule(ts, { script }, emberTemplateImportsEnvironment);
941+
942+
expect(transformedModule?.errors?.length).toBe(0);
943+
expect(transformedModule?.transformedContents).toMatchInlineSnapshot(`
944+
"import type { TOC } from '@ember/component/template-only';
945+
946+
const SmolComp =
947+
({} as typeof import("@glint/environment-ember-template-imports/-private/dsl")).templateExpression(function(__glintRef__, __glintDSL__: typeof import("@glint/environment-ember-template-imports/-private/dsl")) {
948+
__glintDSL__.emitContent(__glintDSL__.resolveOrReturn(__glintRef__.args.name)());
949+
__glintRef__; __glintDSL__;
950+
}) satisfies TOC<{ Args: { name: string }}>;
951+
952+
export default ({} as typeof import("@glint/environment-ember-template-imports/-private/dsl")).templateExpression(function(__glintRef__, __glintDSL__: typeof import("@glint/environment-ember-template-imports/-private/dsl")) {
953+
{
954+
const __glintY__ = __glintDSL__.emitComponent(__glintDSL__.resolve(SmolComp)({
955+
name: "Ember", ...__glintDSL__.NamedArgsMarker }));
956+
__glintY__;
957+
}
958+
__glintRef__; __glintDSL__;
959+
}) satisfies TOC<{ Args: {}, Blocks: {}, Element: null }>
960+
"
961+
`);
962+
});
963963
});
964964
});
965965
});

0 commit comments

Comments
 (0)