More explicit naming
This commit is contained in:
parent
aa9d3d1931
commit
089f0f7a87
@ -17,13 +17,13 @@ export function createGetKcContext<KcContextExtension extends { pageId: string }
|
||||
|
||||
function getKcContext<PageId extends ExtendKcContext<KcContextExtension>["pageId"] | undefined = undefined>(params?: {
|
||||
mockPageId?: PageId;
|
||||
storyParams?: DeepPartial<Extract<ExtendKcContext<KcContextExtension>, { pageId: PageId }>>;
|
||||
storyPartialKcContext?: DeepPartial<Extract<ExtendKcContext<KcContextExtension>, { pageId: PageId }>>;
|
||||
}): {
|
||||
kcContext: PageId extends undefined
|
||||
? ExtendKcContext<KcContextExtension> | undefined
|
||||
: Extract<ExtendKcContext<KcContextExtension>, { pageId: PageId }>;
|
||||
} {
|
||||
const { mockPageId, storyParams } = params ?? {};
|
||||
const { mockPageId, storyPartialKcContext } = params ?? {};
|
||||
|
||||
const realKcContext = getKcContextFromWindow<KcContextExtension>();
|
||||
|
||||
@ -52,10 +52,10 @@ export function createGetKcContext<KcContextExtension extends { pageId: string }
|
||||
});
|
||||
}
|
||||
|
||||
if (storyParams !== undefined) {
|
||||
if (storyPartialKcContext !== undefined) {
|
||||
deepAssign({
|
||||
"target": out,
|
||||
"source": storyParams
|
||||
"source": storyPartialKcContext
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -20,13 +20,13 @@ export function createGetKcContext<KcContextExtension extends { pageId: string }
|
||||
|
||||
function getKcContext<PageId extends ExtendKcContext<KcContextExtension>["pageId"] | undefined = undefined>(params?: {
|
||||
mockPageId?: PageId;
|
||||
storyParams?: DeepPartial<Extract<ExtendKcContext<KcContextExtension>, { pageId: PageId }>>;
|
||||
storyPartialKcContext?: DeepPartial<Extract<ExtendKcContext<KcContextExtension>, { pageId: PageId }>>;
|
||||
}): {
|
||||
kcContext: PageId extends undefined
|
||||
? ExtendKcContext<KcContextExtension> | undefined
|
||||
: Extract<ExtendKcContext<KcContextExtension>, { pageId: PageId }>;
|
||||
} {
|
||||
const { mockPageId, storyParams } = params ?? {};
|
||||
const { mockPageId, storyPartialKcContext } = params ?? {};
|
||||
|
||||
const realKcContext = getKcContextFromWindow<KcContextExtension>();
|
||||
|
||||
@ -55,10 +55,10 @@ export function createGetKcContext<KcContextExtension extends { pageId: string }
|
||||
});
|
||||
}
|
||||
|
||||
if (storyParams !== undefined) {
|
||||
if (storyPartialKcContext !== undefined) {
|
||||
deepAssign({
|
||||
"target": out,
|
||||
"source": storyParams
|
||||
"source": storyPartialKcContext
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ describe("createGetKcContext", () => {
|
||||
|
||||
const { kcContext } = getKcContext({
|
||||
"mockPageId": "login.ftl",
|
||||
"storyParams": {
|
||||
"storyPartialKcContext": {
|
||||
"realm": {
|
||||
displayName
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user