Skip to content
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

Closed

Conversation

novakzaballa
Copy link

Closes #52

@novakzaballa novakzaballa requested review from khvn26 and a team August 15, 2024 02:39
Copy link
Contributor

@matthewelwell matthewelwell left a 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/Flagsmith.kt Outdated Show resolved Hide resolved
FlagsmithClient/src/test/java/com/flagsmith/TraitsTests.kt Outdated Show resolved Hide resolved
FlagsmithClient/src/test/java/com/flagsmith/TraitsTests.kt Outdated Show resolved Hide resolved
mockServer.mockResponseFor(MockEndpoint.GET_TRANSIENT_IDENTITIES)
runBlocking {
val result = flagsmith.getIdentitySync("transient-identity")
Copy link
Contributor

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?

Copy link
Contributor

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)
Copy link
Contributor

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:

  1. I have no idea how this is even supposed to work since we're not setting any transient traits as part of this request.
  2. This test is literally just searching for a trait that has transient = true... then asserting that transient = true

Copy link
Contributor

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)
Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, Corrected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support transient identities and traits
2 participants