diff --git a/src/test/java/roomescape/auth/web/support/CookieUtilsTest.kt b/src/test/java/roomescape/auth/web/support/CookieUtilsTest.kt index 11bf1952..daa3a066 100644 --- a/src/test/java/roomescape/auth/web/support/CookieUtilsTest.kt +++ b/src/test/java/roomescape/auth/web/support/CookieUtilsTest.kt @@ -33,6 +33,15 @@ class CookieUtilsTest : FunSpec({ this.value shouldBe "" } } + + test("httpServletRequest.cookies가 null이면 accessToken에 빈 값을 담은 쿠키를 반환한다.") { + every { httpServletRequest.cookies } returns null + + assertSoftly(httpServletRequest.accessTokenCookie()) { + this.name shouldBe ACCESS_TOKEN_COOKIE_NAME + this.value shouldBe "" + } + } } context("TokenResponse를 쿠키로 반환한다.") { @@ -41,11 +50,11 @@ class CookieUtilsTest : FunSpec({ val result: String = tokenResponse.toResponseCookie() result.split("; ") shouldContainAll listOf( - "accessToken=test-token", - "HttpOnly", - "Secure", - "Path=/", - "Max-Age=1800" + "accessToken=test-token", + "HttpOnly", + "Secure", + "Path=/", + "Max-Age=1800" ) } @@ -53,11 +62,11 @@ class CookieUtilsTest : FunSpec({ val result: String = expiredAccessTokenCookie() result.split("; ") shouldContainAll listOf( - "accessToken=", - "HttpOnly", - "Secure", - "Path=/", - "Max-Age=0" + "accessToken=", + "HttpOnly", + "Secure", + "Path=/", + "Max-Age=0" ) } })