Conversation
gslaughl
approved these changes
Dec 16, 2019
Contributor
gslaughl
left a comment
There was a problem hiding this comment.
Nice catch! Pretty sure I'm responsible for most of these, because I didn't bother to figure out what ErrCouldNotCreateFK was doing before I used it. Lesson learned!
This does seem difficult to test. I guess technically the cleanest solution would be to hide shared.GetOrCreateAddress etc. behind an interface like you mentioned, but tbh that hardly seems worthwhile just to test that an error is being returned. It seems simple enough that we don't need to invest much time into testing it, although I can see why that's ironic coming from someone who repeatedly messed it up 😅
0d6c25f to
f7ace91
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks @m0ar for noticing this issue!
Ideally I'd love to have tests to hedge against regressions here, but I was having trouble coming up for an effective strategy for doing so. Normally I'd mock the namespace that inserts an
ilkoraddress, but those aren't behind an interface right now (maybe worth considering?). Some things I tried:db.Get(maybe we need a null check on the db in converters that use it?)Would welcome ideas!