-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: deep merge changes into resolution context and plug/private to a…
…void overriding things
- Loading branch information
Showing
9 changed files
with
194 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
defmodule RequestCache.UtilTest do | ||
@moduledoc false | ||
|
||
use ExUnit.Case, async: true | ||
|
||
describe "&deep_merge/2" do | ||
test "deep merges keywords with nested maps and keywords properly" do | ||
date_time_a = DateTime.utc_now() | ||
date_time_b = DateTime.add(DateTime.utc_now(), 100) | ||
|
||
assert [ | ||
apple: %{ | ||
a: 2, | ||
b: 3, | ||
c: 4, | ||
date: date_time_b | ||
}, | ||
|
||
banana: [a: 1, b: 2], | ||
] === RequestCache.Util.deep_merge( | ||
[apple: %{a: 1, b: 3, date: date_time_a}, banana: [a: 1]], | ||
[apple: %{a: 2, c: 4, date: date_time_b}, banana: [b: 2]] | ||
) | ||
end | ||
|
||
test "deep merges maps with nested keywords and maps properly" do | ||
date_time_a = DateTime.utc_now() | ||
date_time_b = DateTime.add(DateTime.utc_now(), 100) | ||
|
||
assert %{ | ||
banana: %{a: 1, b: 2}, | ||
apple: [ | ||
b: 3, | ||
a: 2, | ||
c: 4, | ||
date: date_time_b | ||
] | ||
} === RequestCache.Util.deep_merge( | ||
%{apple: [a: 1, b: 3, date: date_time_a], banana: %{a: 1}}, | ||
%{apple: [a: 2, c: 4, date: date_time_b], banana: %{b: 2}} | ||
) | ||
end | ||
end | ||
end |
Oops, something went wrong.