Smarter getKcContext typing

This commit is contained in:
garronej
2023-04-16 03:00:03 +02:00
parent f6e6cf3750
commit d1cc6ed88d
3 changed files with 16 additions and 4 deletions

View File

@ -258,4 +258,16 @@ describe("createGetKcContext", () => {
assert<Equals<typeof kcContext, KcContext.Login | KcContext.Register>>();
});
it("no undefined as long as we provide a mock pageId", () => {
const { getKcContext } = createGetKcContext();
const mockPageId: KcContext["pageId"] = "login.ftl" as any;
const { kcContext } = getKcContext({
mockPageId
});
assert<Equals<typeof kcContext, KcContext>>();
});
});