-
Notifications
You must be signed in to change notification settings - Fork 48
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
Fix FileAttachment Queue Bug #226
Conversation
- add return statement to prevent adding event to queue
@@ -241,6 +241,10 @@ boolean optLocationOut() { | |||
return isLocationOpted; | |||
} | |||
|
|||
EventsQueue getQueue() { |
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 the benefit of exposing/relaxing access restriction to queue object? it seems you just want to check if queue is empty, can we instead expose boolean isQueueEmpty()
api?
@@ -473,6 +473,38 @@ public void checksSessionIdRotationIntervalNotUpdated() throws Exception { | |||
assertFalse(notUpdatedSessionInterval); | |||
} | |||
|
|||
@Test | |||
public void checksAppUserTurnstileNotQueued() throws Exception { | |||
Context mockedContext = obtainNetworkConnectedMockedContext(); |
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.
is there a way to avoid mocking external classes (android framework and okhttp) in our tests?
theMapboxTelemetry.enable(); | ||
theMapboxTelemetry.push(whitelistedEvent); | ||
|
||
assertEquals(0, theMapboxTelemetry.getQueue().queue.size()); |
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 could also do assertTrue(theMapboxTelemetry.isQueueEmpty())
if you'd expose boolean isQueueEmpty()
api.
- create isQueueEmpty method - add to tests - remove mocking calls from within tests
- overload method accidentally split
- fix order of overload method
@@ -241,6 +241,10 @@ boolean optLocationOut() { | |||
return isLocationOpted; | |||
} | |||
|
|||
Boolean isQueueEmpty() { |
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'd suggest to avoid boxed types and use primitives, in this particular case boolean
is the way to go.
Prevent
FileAttachment
event from being added to queue, in addition to sending it up through attachment logic.Add in unit test to confirm that
whitelisted
events are not added to queue.\Fixes #225