-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Support transient identities and traits #54
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@novakzaballa quite a lot of changes needed here. I appreciate that Kotlin isn't a language you are familiar with, but I would certainly expect a bit more thought and care over some of the items I've highlighted in my review here.
FlagsmithClient/src/main/java/com/flagsmith/entities/IdentityAndTraits.kt
Outdated
Show resolved
Hide resolved
FlagsmithClient/src/main/java/com/flagsmith/entities/IdentityFlagsAndTraits.kt
Outdated
Show resolved
Hide resolved
mockServer.mockResponseFor(MockEndpoint.GET_TRANSIENT_IDENTITIES) | ||
runBlocking { | ||
val result = flagsmith.getIdentitySync("transient-identity") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't testing transiency at all! It's not setting the transient
attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that it's relying on the mocked server response, but really this isn't good enough.
result.getOrThrow().traits.find { trait -> trait.key == "favourite-colour" }?.stringValue | ||
) | ||
assertTrue(result.getOrThrow().traits.find { trait -> trait.transient == true }?.transient == true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this? 2 things:
- I have no idea how this is even supposed to work since we're not setting any transient traits as part of this request.
- This test is literally just searching for a trait that has
transient = true
... then asserting thattransient = true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I think (1) can be answer by the use of MockEndpoint.GET_TRANSIENT_IDENTITIES
, but (2) still stands.
@@ -77,7 +77,7 @@ class TraitEntityTests { | |||
|
|||
@Test | |||
fun testTraitConstructorStringType() { | |||
val trait = Trait( "string-key", "string-value") | |||
val trait = Trait( "string-key", "string-value", false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned above, this shouldn't be necessary. This shouldn't need to be a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, Corrected
Closes #52