Skip to content

Commit

Permalink
Process sso-session names with config prefix separator (#1173)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored Feb 27, 2024
1 parent 3357fda commit 8fd5196
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/swift-cups-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@smithy/shared-ini-file-loader": patch
---

Process sso-session names with config prefix separator
6 changes: 6 additions & 0 deletions packages/shared-ini-file-loader/src/getSsoSessionData.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ describe(getSsoSessionData.name, () => {
{}
);

it(`sso-session section with prefix separator ${CONFIG_PREFIX_SEPARATOR}`, () => {
const mockOutput = getMockOutput([["prefix", "suffix"].join(CONFIG_PREFIX_SEPARATOR)]);
const mockInput = getMockInput(mockOutput);
expect(getSsoSessionData(mockInput)).toStrictEqual(mockOutput);
});

it("single sso-session section", () => {
const mockOutput = getMockOutput(["one"]);
const mockInput = getMockInput(mockOutput);
Expand Down
2 changes: 1 addition & 1 deletion packages/shared-ini-file-loader/src/getSsoSessionData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export const getSsoSessionData = (data: ParsedIniData): ParsedIniData =>
// filter out non sso-session keys
.filter(([key]) => key.startsWith(IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR))
// replace sso-session key with sso-session name
.reduce((acc, [key, value]) => ({ ...acc, [key.split(CONFIG_PREFIX_SEPARATOR)[1]]: value }), {});
.reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {});

0 comments on commit 8fd5196

Please sign in to comment.