Created
November 11, 2020 01:43
-
-
Save phellipealexandre/048aa4dc57ca1dd72fc4e2ffcca436fc to your computer and use it in GitHub Desktop.
Configuração de um Mock utilizando api do MockK.
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
@Test | |
fun `Track analytics event when creating new note`() { | |
val analyticsWrapperMock = mockk<AnalyticsWrapper>() //Dublê de teste Mock | |
val noteAnalytics = NoteAnalytics(analyticsWrapperMock) | |
noteAnalytics.trackNewNoteEvent(NoteType.Supermarket) | |
//Mock verifica que comportamento específico aconteceu | |
verify(exactly = 1) { analyticsWrapperMock.logEvent("NewNote", "SuperMarket") } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment