Skip to content

Commit 15e43ff

Browse files
author
LFRW2K\lecmil2
committed
[EVO] Added test for custom template name in registry
1 parent 8640c60 commit 15e43ff

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/utils/test/getTemplate.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,23 @@ describe('getTemplate', () => {
9494
name,
9595
registry,
9696
Object.keys(uiOptions).reduce((uiOptions, key) => {
97-
uiOptions[key] = key;
97+
(uiOptions as Record<string, any>)[key] = key;
9898
return uiOptions;
9999
}, {})
100100
)
101101
).toBe(FakeTemplate);
102102
});
103103
});
104+
it('returns the custom template name from the registry', () => {
105+
const customTemplateKey = 'CustomTemplate';
106+
registry.templates[customTemplateKey] = FakeTemplate;
107+
108+
expect(getTemplate(customTemplateKey, registry)).toBe(FakeTemplate);
109+
});
110+
111+
it('returns undefined when the custom template is not in the registry', () => {
112+
const customTemplateKey = 'CustomTemplate';
113+
114+
expect(getTemplate(customTemplateKey, registry)).toBeUndefined();
115+
});
104116
});

0 commit comments

Comments
 (0)