otuv
What is the standard way to test a map structure
Hi,
I’m trying to make an assertion that an item has recieved yet another timestamp in a list. My current solution is to do a regular match which will fail the test if not working. I obviously find out if my test does not work but it feels rather hacky and not a proper solution.
What I would like to do is something similar to:
assert [{id, [_t1, _t2]}] == updated_thing.list_with_timestamps
But that only works if I specify the _t1 and _t2 which obviously does not work with timestamps…
What is the standard way to test this?
Most Liked
zoedsoupe
This timestamp is what? A NaiveDateTime? A DateTime? A Date? A String? And you’re asserting strict equality, not only matching! Please, give a example structure
ityonemo
assert [<<_::binary>>,<<_:: binary>>] = value
If you know the results but order is nondeterministic, Enum.sort both sides.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








