Skip to content

Commit

Permalink
chore: More tests for "renameKeys" and "upsertWith"
Browse files Browse the repository at this point in the history
  • Loading branch information
andreidmt committed Dec 10, 2020
1 parent 9bc9656 commit 955c514
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/rename-keys/rename-keys.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ test("renameKeys", t => {
"Renaming non-existing key shoud return new object with same values"
)

t.deepEqual(
renameKeys({ foo: "lorem" }, { foo: "bar", lorem: "ipsum" }),
{ lorem: "bar" },
"Renaming existing key to other existing shoud return new object replaced value"
)

t.deepEqual(
renameKeys({ test: "changed" }, [
{ test: "Lorem Ipsum" },
Expand Down
4 changes: 2 additions & 2 deletions src/upsert/upsert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test("upsertWith", t => {
t.deepEquals(
upsertWith(
{ id: 2 },
{ id: 2, title: [source => `${source} ipsum`], foo: "bar" }
{ id: 2, title: source => `${source} ipsum`, foo: "bar" }
)([{ id: 2, title: "lorem" }]),
[{ id: 2, title: "lorem ipsum", foo: "bar" }],
"Update value if exists"
Expand All @@ -20,7 +20,7 @@ test("upsertWith", t => {
t.deepEquals(
upsertWith(
{ id: 1 },
{ id: 1, title: [source => `${source} ipsum`] }
{ id: 1, title: source => `${source} ipsum` }
)([{ id: 2 }]),
[{ id: 2 }, { id: 1, title: "undefined ipsum" }],
"Update value if exists"
Expand Down

0 comments on commit 955c514

Please sign in to comment.