"""Tests for raycast_api.signing.canonical.""" from __future__ import annotations from raycast_api.signing.canonical import build_canonical from raycast_api.signing_spec import RotRange RAYCAST_RANGES = [ RotRange(0x41, 0x5A, 13), RotRange(0x61, 0x7A, 13), RotRange(0x30, 0x39, 5), ] def test_components_transformed_then_joined() -> None: out = build_canonical(["abc", "123", "XYZ"], RAYCAST_RANGES, ".") assert out == "nop.678.KLM" def test_join_char_is_used_verbatim() -> None: out = build_canonical(["abc", "abc"], RAYCAST_RANGES, ":") assert out == "nop:nop" def test_zero_components_yields_empty_string() -> None: assert build_canonical([], RAYCAST_RANGES, ".") == "" def test_single_component_no_separator() -> None: assert build_canonical(["abc"], RAYCAST_RANGES, ".") == "nop" def test_components_independent() -> None: assert build_canonical(["a", "b"], RAYCAST_RANGES, ".") == "n.o"