From 0cc69179d164c6beddaa17b3dfbcd8008a33e3fe Mon Sep 17 00:00:00 2001 From: pricelees Date: Tue, 15 Jul 2025 12:07:40 +0900 Subject: [PATCH] =?UTF-8?q?test:=20CookieUtilsTest=EC=97=90=20null=20?= =?UTF-8?q?=EB=B0=98=ED=99=98=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/web/support/CookieUtilsTest.kt | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) 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" ) } })