Skip to content

Commit

Permalink
Rework how options in tests are given
Browse files Browse the repository at this point in the history
  • Loading branch information
Quicksaver committed Feb 12, 2024
1 parent e2bea6f commit 8c3d966
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions packages/change-case/src/keys.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ const TEST_CASES: [unknown, number | undefined, unknown][] = [
],
[{ TEST: true }, 0, { TEST: true }],
[null, 1, null],
];

const TEST_CASES_MERGE_AMBIGUOUS: [unknown, number | undefined, unknown][] = [
[
{
outer_property_1_2: "outer",
Expand All @@ -56,21 +53,14 @@ const TEST_CASES_MERGE_AMBIGUOUS: [unknown, number | undefined, unknown][] = [
outerProperty12: "outer",
anArray: [{ innerProperty34: true }],
},
{ mergeAmbiguousCharacters: true },
],
];

describe("change keys", () => {
for (const [input, depth, result] of TEST_CASES) {
it(`${input} -> ${result}`, () => {
expect(camelCase(input, depth)).toEqual(result);
});
}

for (const [input, depth, result] of TEST_CASES_MERGE_AMBIGUOUS) {
for (const [input, depth, result, options] of TEST_CASES) {
it(`${input} -> ${result}`, () => {
expect(
camelCase(input, depth, { mergeAmbiguousCharacters: true }),
).toEqual(result);
expect(camelCase(input, depth, options)).toEqual(result);
});
}
});

0 comments on commit 8c3d966

Please sign in to comment.