Skip to content

Commit

Permalink
[KAN-107] 1퍼 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkyoungdeok committed May 31, 2024
1 parent 65d0f31 commit 5565e27
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 11 deletions.
32 changes: 32 additions & 0 deletions src/test/kotlin/com/restaurant/be/BeApplicationTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.restaurant.be

import com.restaurant.be.common.CustomDescribeSpec
import com.restaurant.be.common.IntegrationTest
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.matchers.shouldBe
import io.kotest.matchers.shouldNotBe
import org.springframework.context.ApplicationContextException

@IntegrationTest
class BeApplicationTest(
context: org.springframework.context.ApplicationContext
) : CustomDescribeSpec() {

init {
describe("BeApplication") {
it("should load Spring context successfully") {
context shouldNotBe null
}

it("should have BeApplication bean") {
context.containsBean("beApplication") shouldBe true
}

it("test") {
shouldThrow<ApplicationContextException> {
main(arrayOf())
}
}
}
}
}
11 changes: 0 additions & 11 deletions src/test/kotlin/com/restaurant/be/BeApplicationTests.kt

This file was deleted.

37 changes: 37 additions & 0 deletions src/test/kotlin/com/restaurant/be/WebRestControllerTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.restaurant.be

import io.kotest.core.spec.style.DescribeSpec
import io.kotest.matchers.shouldBe
import io.mockk.every
import io.mockk.mockk
import org.springframework.core.env.Environment

class WebRestControllerTest : DescribeSpec({

val environment = mockk<Environment>()
val controller = WebRestController(environment)

describe("WebRestController") {

context("when there is an active profile") {
it("should return the active profile") {
val activeProfile = "test-profile"
every { environment.activeProfiles } returns arrayOf(activeProfile)

val result = controller.getProfile()

result shouldBe activeProfile
}
}

context("when there is no active profile") {
it("should return 'No Active Profile'") {
every { environment.activeProfiles } returns arrayOf()

val result = controller.getProfile()

result shouldBe "No Active Profile"
}
}
}
})

0 comments on commit 5565e27

Please sign in to comment.