Skip to content

Commit

Permalink
tree can have more than one parent node
Browse files Browse the repository at this point in the history
  • Loading branch information
electronicbites committed Mar 30, 2024
1 parent fb008ec commit eef2106
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/radiator/outline_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,33 @@ defmodule Radiator.OutlineTest do
assert_level_for_node(tree, nested_node_1, 2)
assert_level_for_node(tree, nested_node_2, 2)
end

test "tree can have more than one parent node", %{
parent_node: parent_node
} do
episode_id = parent_node.episode_id

other_parent_node =
node_fixture(
parent_id: nil,
prev_id: parent_node.uuid,
episode_id: episode_id,
content: "also a parent"
)

third_parent_node =
node_fixture(
parent_id: nil,
prev_id: other_parent_node.uuid,
episode_id: episode_id,
content: "even another root element"
)

{:ok, tree} = Outline.get_node_tree(parent_node.episode_id)
assert_level_for_node(tree, parent_node, 0)
assert_level_for_node(tree, other_parent_node, 0)
assert_level_for_node(tree, third_parent_node, 0)
end
end

defp assert_level_for_node(tree, node, level) do
Expand Down

0 comments on commit eef2106

Please sign in to comment.