jjh42 / mock

Mocking library for Elixir language
MIT License
639 stars 81 forks source link

Assert called does not assert equality when an argument is a map #141

Open mrnovalles opened 7 months ago

mrnovalles commented 7 months ago

We are currently using assert_called in a test, where one of the arguments is a list of maps. This test should have failed given that one of the keys inside one of those maps had a nil value, but it did not.

test_with_mock "sends a push notification",
  %{key: value }},
  PushNotifications,
  [:passthrough],
  send: fn _ -> :ok end do

    PushNotifications.send([%{notification_type: "type1", properties: %{}, recipient_id: "user_2", send_at: nil}])

    assert_called(
      PushNotifications.send([ %{notification_type: "cm_start", properties: %{}, recipient_id: "user_1"}])
    )
end

I tried reproducing this issue by adding a failing test in https://github.com/eproxus/meck. But it does not seem to behave in this way. PR: https://github.com/eproxus/meck/pull/242/files

Do you have any pointers into why this can be happening? Happy to dig to the root cause of this. Thanks for your work on this lib.