wire-subsystems: Make mock for UserSubsystem depend on UserStore#5078
wire-subsystems: Make mock for UserSubsystem depend on UserStore#5078akshaymankar merged 5 commits intodevelopfrom
Conversation
This way while testing other subsystems which may be writing to/reading from UserStore will remain consistent. This is only useful for AuthenticationSubsystem as of now.
|
|
||
| userSubsystemTestInterpreter :: [User] -> InterpreterFor UserSubsystem r | ||
| userSubsystemTestInterpreter initialUsers = | ||
| runInMemoryUserSubsytemInterpreter :: [StoredUser] -> InterpreterFor UserSubsystem r |
There was a problem hiding this comment.
why doesn't this need the Member constraints from inMemoryUserSubsystemInterpreter?
There was a problem hiding this comment.
Because it interprets the effects, or do I misunderstand the question?
| userSubsystemTestInterpreter :: [User] -> InterpreterFor UserSubsystem r | ||
| userSubsystemTestInterpreter initialUsers = | ||
| runInMemoryUserSubsytemInterpreter :: [StoredUser] -> InterpreterFor UserSubsystem r | ||
| runInMemoryUserSubsytemInterpreter initialUsers = |
There was a problem hiding this comment.
I'm confused: doesn't this go against the idea of shallow mocking, and more towards the MiniBackend approach?
But I'm all for it :)
There was a problem hiding this comment.
IMO It is still a shallow mock, I was debating whether to add all the UserStore stuff in here or just use the mock. It seemed to matter little, so I used the UserStore as a dependency.
libs/wire-subsystems/test/unit/Wire/TeamInvitationSubsystem/InterpreterSpec.hs
Outdated
Show resolved
Hide resolved
libs/wire-subsystems/test/unit/Wire/TeamInvitationSubsystem/InterpreterSpec.hs
Outdated
Show resolved
Hide resolved
| . interpretAuthenticationSubsystem (userSubsystemTestInterpreter preexistingUsers) | ||
| . inMemoryUserSubsystemInterpreter | ||
| . interpretAuthenticationSubsystem inMemoryUserSubsystemInterpreter |
There was a problem hiding this comment.
this is fine, but here's a nit-pick: in another place that i like better, we mutually recursive let bindings for auth and user subsystems. this makes it harder to accidentally only change on of the two occurrances of inMemoryUserSubsystemInterpreter.
There was a problem hiding this comment.
These are not mutually recursive, the mock interpreter for UserSubsystem doesn't depend on AuthenticationSubsystem. I think I might even be able to get rid of UserSubsystem from this stack.
https://wearezeta.atlassian.net/browse/WPB-22747
This way while testing other subsystems which may be writing to/reading from UserStore will remain consistent. This is only useful for AuthenticationSubsystem as of now.
Checklist
Add a new entry in an appropriate subdirectory ofNo changelog.changelog.d