penumbra-zone / web

Apache License 2.0
12 stars 15 forks source link

Mocks should use actual interfaces #680

Open turbocrime opened 7 months ago

turbocrime commented 7 months ago

https://github.com/penumbra-zone/web/blob/main/packages/router/src/grpc/test-utils.ts

Instead of duplicating many interfaces with mock interfaces, and reimplementing mocks multiple times in several files to meet those interfaces, it is preferable to implement a versatile mock once, to meet the real interface, and then import it where used.

grod220 commented 7 months ago

@Valentine1898 would be great for you to take this one

Valentine1898 commented 7 months ago

I'm not sure I'm understanding the idea correctly. The point is that we most often have to have different mock implementations for different test cases

turbocrime commented 6 months ago

https://github.com/penumbra-zone/web/pull/672/files/a1144fe524db25b9eb39a92ff52dfbc5b2611f48#r1521909534