You've already forked tribes-plugin-aether
forked from tribes/tribes-plugin-template
c1f4339dde
Use TribeOne.TribesPlugin.Aether modules throughout the plugin and expose chat@1 from the entry module for capability-based consumers.
45 lines
1.4 KiB
Elixir
45 lines
1.4 KiB
Elixir
defmodule TribeOne.TribesPlugin.Aether.TimelinePageTest do
|
|
use Tribes.PluginTest.PageCase, plugin: TribeOne.TribesPlugin.Aether.Plugin
|
|
|
|
test "renders the timeline for signed-out visitors", %{conn: conn} do
|
|
{:ok, _view, html} = live(conn, "/aether")
|
|
|
|
assert html =~ "Aether"
|
|
assert html =~ "Sign in to publish notes from your local identity."
|
|
end
|
|
|
|
test "renders the posting form for signed-in users", %{signed_in_conn: conn, current_user: user} do
|
|
{:ok, view, _html} = live(conn, "/aether")
|
|
|
|
assert has_element?(view, "#note-form")
|
|
assert has_element?(view, "#post-note-button", "Post note")
|
|
assert is_binary(user.username)
|
|
end
|
|
|
|
test "handles batched Parrhesia note events", %{signed_in_conn: conn, current_user: user} do
|
|
{:ok, view, _html} = live(conn, "/aether")
|
|
|
|
send(view.pid, {:parrhesia, :events, make_ref(), "aether", [note_event(user.pubkey_hex)]})
|
|
|
|
assert render(view) =~ "Streamed batch note"
|
|
end
|
|
|
|
test "dispatches top-level subpaths to the timeline page", %{conn: conn} do
|
|
{:ok, _view, html} = live(conn, "/aether/tribe-123")
|
|
|
|
assert html =~ "Aether"
|
|
end
|
|
|
|
defp note_event(pubkey) do
|
|
%{
|
|
"id" => "batch-note-#{System.unique_integer([:positive])}",
|
|
"pubkey" => pubkey,
|
|
"created_at" => 1_777_237_381,
|
|
"kind" => 1,
|
|
"tags" => [],
|
|
"content" => "Streamed batch note",
|
|
"sig" => "test-signature"
|
|
}
|
|
end
|
|
end
|