Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

Commit 5656052

Browse files
committed
Fix normalized name
1 parent cb369fc commit 5656052

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/commands/hld/reconcile.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,15 @@ describe("normalizedName", () => {
741741
expect(normalizedName("fabrikam.frontend")).toBe("fabrikam-frontend");
742742
});
743743

744+
it("can handle multiple occurences of invalid characters", () => {
745+
expect(normalizedName("fabrikam.frontend.foo")).toBe(
746+
"fabrikam-frontend-foo"
747+
);
748+
expect(normalizedName("fabrikam/frontend/foo")).toBe(
749+
"fabrikam-frontend-foo"
750+
);
751+
});
752+
744753
it("can handle combinations of slashes and periods and caps in a name", () => {
745754
expect(normalizedName("Fabrikam.frontend/CartService")).toBe(
746755
"fabrikam-frontend-cartservice"

src/commands/hld/reconcile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ export interface IReconcileDependencies {
7777
export const normalizedName = (name: string): string => {
7878
return name
7979
.toLowerCase()
80-
.replace("/", "-")
81-
.replace(".", "-");
80+
.replace(/\//g, "-")
81+
.replace(/\./g, "-");
8282
};
8383

8484
export const execute = async (

0 commit comments

Comments
 (0)