Skip to content

Commit

Permalink
Unit test the proxy change
Browse files Browse the repository at this point in the history
  • Loading branch information
karreiro committed Aug 2, 2024
1 parent fce7ec1 commit 4c14cbb
Showing 1 changed file with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,33 @@ def test_refreshes_session_cookie_on_expiry
times: 2)
end

def xtest_update_session_cookie_when_returned_from_backend
stub_session_id_request
def test_update_session_cookie_when_returned_from_backend
new_shopify_essential = "#{SECURE_SESSION_ID}2"

stub_request(:head, "https://dev-theme-server-store.myshopify.com/?_fd=0&pb=0&preview_theme_id=123456789")
.with(
headers: {
"Host" => "dev-theme-server-store.myshopify.com",
},
)
.to_return([
{
status: 200,
headers: {
"Set-Cookie" => "_shopify_essential=#{SECURE_SESSION_ID}",
},
},
{
status: 200,
headers: {
"Set-Cookie" => "_shopify_essential=#{new_shopify_essential}",
},
},
])

# Force the _shopify_essential cookie to be refreshed.
@proxy.stubs(:secure_session_id_expired?).returns(true)

# POST response returning a new session cookie (Set-Cookie)
stub_request(:post, "https://dev-theme-server-store.myshopify.com/account/login?_fd=0&pb=0")
.with(
Expand Down

0 comments on commit 4c14cbb

Please sign in to comment.