-
Notifications
You must be signed in to change notification settings - Fork 6
Chore: stringfy_map/1 changes order of Map keys intermittently. #56
Copy link
Copy link
Closed
Labels
T25mTime Estimate 25 MinutesTime Estimate 25 Minuteschorea tedious but necessary task often paying technical debta tedious but necessary task often paying technical debtenhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededpriority-1Highest priority issue. This is costing us money every minute that passes.Highest priority issue. This is costing us money every minute that passes.technicalA technical issue that requires understanding of the code, infrastructure or dependenciesA technical issue that requires understanding of the code, infrastructure or dependenciesuser-feedbackFeedback from people using the AppFeedback from people using the App
Description
while the Useful.stringfy_map/1 function works to stringify the Map,
the tests assertions fail intermittently because the map keys are being positioned in different order.
Best explained by the following test failures:
1) test stringfy_map/1 converts nested maps into strings (UsefulTest)
test/useful_test.exs:199
Assertion with == failed
code: assert Useful.stringify_map(map) == "data__name: Vitor, data__other__data: info, id: 1"
left: "id: 1, data__name: Vitor, data__other__data: info"
right: "data__name: Vitor, data__other__data: info, id: 1"
stacktrace:
test/useful_test.exs:201: (test)
2) doctest Useful.stringify_map/1 (5) (UsefulTest)
test/useful_test.exs:4
Doctest failed
doctest:
iex> map = %{name: "alex", data: %{age: 17, height: 185}}
iex> Useful.stringify_map(map)
"data__age: 17, data__height: 185, name: alex"
code: Useful.stringify_map(map) === "data__age: 17, data__height: 185, name: alex"
left: "name: alex, data__age: 17, data__height: 185"
right: "data__age: 17, data__height: 185, name: alex"
stacktrace:
lib/useful.ex:142: Useful (module)
3) test stringfy_map/1 converts nested lists into strings (UsefulTest)
test/useful_test.exs:204
Assertion with == failed
code: assert Useful.stringify_map(map) == "data__names: \"Vitor, alex\", id: 1"
left: "id: 1, data__names: \"Vitor, alex\""
right: "data__names: \"Vitor, alex\", id: 1"
stacktrace:
test/useful_test.exs:206: (test)This isn't really a "bug" per se. More of an annoying quirk that we need to fix.
Again, the function works but we want the assertions to be 100% consistent.
Therefore ...
Todo
- Alphabetise the
Mapkeys before stringifying them.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
T25mTime Estimate 25 MinutesTime Estimate 25 Minuteschorea tedious but necessary task often paying technical debta tedious but necessary task often paying technical debtenhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededpriority-1Highest priority issue. This is costing us money every minute that passes.Highest priority issue. This is costing us money every minute that passes.technicalA technical issue that requires understanding of the code, infrastructure or dependenciesA technical issue that requires understanding of the code, infrastructure or dependenciesuser-feedbackFeedback from people using the AppFeedback from people using the App
Type
Projects
Status
✅ Done
Status
Done