Skip to content

Commit

Permalink
fix annoying ambiguity in conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
TheKhanj committed Mar 16, 2024
1 parent c9bec94 commit d391a8d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion constants.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export const CONVENTIONS = [
"kebab",
"camel",
"screaming-kebab",
"pascal",
"snake",
"screaming-kebab",
"screaming-snake",
] as const;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "convconv",
"version": "0.3.7",
"version": "0.3.8",
"description": "Naming Conventions Converter",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
18 changes: 11 additions & 7 deletions test/convconv.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ describe("convconv", () => {
expect(
convconv
.fromConvention(fromConvention, from)
.toConvention(toConvention),
.toConvention(toConvention)
).toBe(to);
},
),
}
)
);

allTests.forEach((tests) =>
Expand All @@ -54,8 +54,8 @@ describe("convconv", () => {
const to = tests[toConvention];

expect(convconv.autoFrom(from).toConvention(toConvention)).toBe(to);
},
),
}
)
);

test.each([
Expand All @@ -67,8 +67,12 @@ describe("convconv", () => {
"getConvention should throw ConventionNotFoundError for invalid inputs",
(from: string) => {
expect(() => convconv.getConvention(from)).toThrow(
convconv.ConventionNotFoundError,
convconv.ConventionNotFoundError
);
},
}
);

test("it should recognize only uppercase letters as screaming kebab case", () => {
expect(convconv.getConvention("UPPER")).toBe("screaming-kebab");
});
});

0 comments on commit d391a8d

Please sign in to comment.