Skip to content

Instantly share code, notes, and snippets.

@delabassee
Last active July 18, 2018 14:52
Show Gist options
  • Save delabassee/9888e807d6140ed5569dfd204c2c9119 to your computer and use it in GitHub Desktop.
Save delabassee/9888e807d6140ed5569dfd204c2c9119 to your computer and use it in GitHub Desktop.
import com.fnproject.fn.testing.*
import org.junit.*
import kotlin.test.assertEquals
class HelloFunctionTest {
@Rule @JvmField
val fn = FnTestingRule.createDefault()
@Test
fun `should return default greeting`() {
with (fn) {
givenEvent().enqueue()
thenRun("HelloFunctionKt","hello")
assertEquals("Hello, world!", getOnlyResult().getBodyAsString())
}
}
@Test
fun `should return personalized greeting`() {
with (fn) {
givenEvent().withBody("Jhonny").enqueue()
thenRun("HelloFunctionKt","hello")
assertEquals("Hello, Jhonny", getOnlyResult().getBodyAsString())
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment