From eef210643ae1b3a8495a03f4f852e396c790e3b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20W=C3=B6ginger?= Date: Sat, 30 Mar 2024 18:36:08 +0100 Subject: [PATCH] tree can have more than one parent node --- test/radiator/outline_test.exs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/radiator/outline_test.exs b/test/radiator/outline_test.exs index ff791590..7c24c342 100644 --- a/test/radiator/outline_test.exs +++ b/test/radiator/outline_test.exs @@ -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