fix: A1-17 route bds2://new-post deep links into transform pipeline and draft creation

This commit is contained in:
2026-05-30 08:58:22 +02:00
parent ebf6136d2f
commit 7045b10738
20 changed files with 1128 additions and 607 deletions

View File

@@ -0,0 +1,34 @@
defmodule BDS.Desktop.DeepLinkTest do
use ExUnit.Case, async: false
alias BDS.Desktop.DeepLink
setup do
topic = "deep-link-test:#{System.unique_integer([:positive])}"
Phoenix.PubSub.subscribe(BDS.PubSub, topic)
{:ok, pid} = DeepLink.start_link(name: nil, pubsub: BDS.PubSub, topic: topic)
on_exit(fn -> if Process.alive?(pid), do: GenServer.stop(pid) end)
%{pid: pid, topic: topic}
end
test "broadcasts a bds2:// open_url event to the shell topic", %{pid: pid} do
url = "bds2://new-post?title=Hello&url=https://example.com"
send(pid, {:open_url, [url]})
assert_receive {:blogmark_deep_link, ^url}, 500
end
test "ignores non-bds2 open_url events", %{pid: pid} do
send(pid, {:open_url, ["https://example.com"]})
refute_receive {:blogmark_deep_link, _url}, 200
end
test "ignores unrelated messages", %{pid: pid} do
send(pid, {:open_file, ["/tmp/x"]})
refute_receive {:blogmark_deep_link, _url}, 200
end
end