Extract the cookie parser, export-payload builder and fee-status helper into their own modules and remove the filter/sort/load helpers the database pushdown made dead, so the overview LiveView stays a thin coordinator over focused units.
22 lines
700 B
Elixir
22 lines
700 B
Elixir
defmodule MvWeb.MemberLive.Index.CookieTest do
|
|
@moduledoc """
|
|
Tests for the shared cookie-header parser used by the overview persistence chain.
|
|
"""
|
|
use ExUnit.Case, async: true
|
|
|
|
alias MvWeb.MemberLive.Index.Cookie
|
|
|
|
describe "parse_header/1" do
|
|
test "splits pairs and URL-decodes values" do
|
|
assert Cookie.parse_header("a=1; b=hello%20world") == %{"a" => "1", "b" => "hello world"}
|
|
end
|
|
|
|
test "maps a valueless entry to an empty string" do
|
|
assert Cookie.parse_header("flag; a=1") == %{"flag" => "", "a" => "1"}
|
|
end
|
|
|
|
test "keeps only the first '=' as the separator" do
|
|
assert Cookie.parse_header("token=a=b=c") == %{"token" => "a=b=c"}
|
|
end
|
|
end
|
|
end
|