Issue with TextRef Comparison
In our unit tests, I've encountered an issue when comparing TextRef objects using the isEqualTo function from the assertion library. The test fails when comparing two TextRef objects directly. Here is an example of the failing test:
expectThat(viewModel.viewState.value)
.isA<ViewState.Ready>()
.get { selectedItem?.subtitle }
.isEqualTo(expected)
To make the test pass, we have to convert the TextRef objects to String before comparing them:
expectThat(viewModel.viewState.value)
.isA<ViewState.Ready>()
.get { selectedItem?.subtitle.toString() }
.isEqualTo(expected.toString())
This workaround is not ideal as it requires additional conversion and may not accurately reflect the intended behavior of the code under test. I believe this issue might be related to how TextRef implements equality checks. I would appreciate it if you could look into this issue and provide guidance on how to properly compare TextRef objects in our tests.
Could you please provide an reproducer?
In fact, all of the tests using the equal function.
There is even an test that tests the equal function 🫠
Closed due of inactivity of reporter. Feel free to comment back, we can open this issue again at any time 🙃