Skip to content

Commit 8fd5196

Browse files
authored
Process sso-session names with config prefix separator (#1173)
1 parent 3357fda commit 8fd5196

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

.changeset/swift-cups-count.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@smithy/shared-ini-file-loader": patch
3+
---
4+
5+
Process sso-session names with config prefix separator

packages/shared-ini-file-loader/src/getSsoSessionData.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ describe(getSsoSessionData.name, () => {
3333
{}
3434
);
3535

36+
it(`sso-session section with prefix separator ${CONFIG_PREFIX_SEPARATOR}`, () => {
37+
const mockOutput = getMockOutput([["prefix", "suffix"].join(CONFIG_PREFIX_SEPARATOR)]);
38+
const mockInput = getMockInput(mockOutput);
39+
expect(getSsoSessionData(mockInput)).toStrictEqual(mockOutput);
40+
});
41+
3642
it("single sso-session section", () => {
3743
const mockOutput = getMockOutput(["one"]);
3844
const mockInput = getMockInput(mockOutput);

packages/shared-ini-file-loader/src/getSsoSessionData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ export const getSsoSessionData = (data: ParsedIniData): ParsedIniData =>
1111
// filter out non sso-session keys
1212
.filter(([key]) => key.startsWith(IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR))
1313
// replace sso-session key with sso-session name
14-
.reduce((acc, [key, value]) => ({ ...acc, [key.split(CONFIG_PREFIX_SEPARATOR)[1]]: value }), {});
14+
.reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {});

0 commit comments

Comments
 (0)