diff --git a/test/outlook/internaltree_test.exs b/test/outlook/internaltree_test.exs index 84bb02b..e902766 100644 --- a/test/outlook/internaltree_test.exs +++ b/test/outlook/internaltree_test.exs @@ -7,7 +7,7 @@ defmodule Outlook.InternalTreeTest do alias Outlook.InternalTree alias Outlook.InternalTree.{InternalNode,TranslationUnit} - @default_uuid "11111111-1111-1111-1111-111111111111" + @default_nid "xxxxxx" test "partition_text/1 returns correctly partitioned text without overlapping markup" do tree = [ @@ -15,13 +15,13 @@ defmodule Outlook.InternalTreeTest do name: "p", attributes: %{}, type: :element, - uuid: "8293da39-18e3-4695-8ec5-a3a4a06f006c", + nid: "8293da39-18e3-4695-8ec5-a3a4a06f006c", content: [ %InternalNode{ name: "", attributes: %{}, type: :text, - uuid: "1b62b02f-0be1-4ba1-88a1-0f08f5a5254d", + nid: "1b62b02f-0be1-4ba1-88a1-0f08f5a5254d", content: "A sentence with many letters ", eph: %{sibling_with: :inline} }, @@ -34,7 +34,7 @@ defmodule Outlook.InternalTreeTest do name: "", attributes: %{}, type: :text, - uuid: "c6816bfe-a660-436b-84ab-64d92417e321", + nid: "c6816bfe-a660-436b-84ab-64d92417e321", content: "and many, many ", eph: %{sibling_with: :inline} }, @@ -47,7 +47,7 @@ defmodule Outlook.InternalTreeTest do name: "", attributes: %{}, type: :text, - uuid: "abcd5893-d062-4716-9979-4bf1f65d5e17", + nid: "abcd5893-d062-4716-9979-4bf1f65d5e17", content: "words. A", eph: %{sibling_with: :inline} } @@ -58,7 +58,7 @@ defmodule Outlook.InternalTreeTest do name: "", attributes: %{}, type: :text, - uuid: "d67f41fe-678a-4e27-99da-00d38decde75", + nid: "d67f41fe-678a-4e27-99da-00d38decde75", content: " sentence", eph: %{sibling_with: :inline} } @@ -69,7 +69,7 @@ defmodule Outlook.InternalTreeTest do name: "", attributes: %{}, type: :text, - uuid: "6fc0bf77-4dc6-4828-866e-2933d393f4b9", + nid: "6fc0bf77-4dc6-4828-866e-2933d393f4b9", content: " with many letters and many, many words. ", eph: %{sibling_with: :inline} } @@ -78,12 +78,12 @@ defmodule Outlook.InternalTreeTest do } ] - assert InternalTree.partition_text(tree) |> unify_uuids_in_tunits() == [ - %InternalNode{name: "p", attributes: %{}, type: :element, uuid: "8293da39-18e3-4695-8ec5-a3a4a06f006c", + assert InternalTree.partition_text(tree) |> unify_nids_in_tunits() == [ + %InternalNode{name: "p", attributes: %{}, type: :element, nid: "8293da39-18e3-4695-8ec5-a3a4a06f006c", content: [ - %TranslationUnit{status: :untranslated, uuid: @default_uuid, + %TranslationUnit{status: :untranslated, nid: @default_nid, content: "A sentence with many letters and many, many words. "}, - %TranslationUnit{status: :untranslated, uuid: @default_uuid, + %TranslationUnit{status: :untranslated, nid: @default_nid, content: "A sentence with many letters and many, many words. "} ], eph: %{sibling_with: :block} @@ -97,13 +97,13 @@ defmodule Outlook.InternalTreeTest do name: "p", attributes: %{}, type: :element, - uuid: "0248aec7-c525-483d-a472-40a34488478d", + nid: "0248aec7-c525-483d-a472-40a34488478d", content: [ %InternalNode{ name: "", attributes: %{}, type: :text, - uuid: "d35ac56f-bf10-47b1-af19-152e6225bb32", + nid: "d35ac56f-bf10-47b1-af19-152e6225bb32", content: "F. William Engdahl is 3.7 times more likely to write a good article than Mike Adams. But this doesn't mean anything bad about Mike.", eph: %{sibling_with: :inline} } @@ -111,21 +111,21 @@ defmodule Outlook.InternalTreeTest do eph: %{sibling_with: :block} } ] - assert InternalTree.partition_text(tree) |> unify_uuids_in_tunits() == [ + assert InternalTree.partition_text(tree) |> unify_nids_in_tunits() == [ %InternalNode{ name: "p", attributes: %{}, type: :element, - uuid: "0248aec7-c525-483d-a472-40a34488478d", + nid: "0248aec7-c525-483d-a472-40a34488478d", content: [ %TranslationUnit{ status: :untranslated, - uuid: @default_uuid, + nid: @default_nid, content: "F. William Engdahl is 3.7 times more likely to write a good article than Mike Adams. " }, %TranslationUnit{ status: :untranslated, - uuid: @default_uuid, + nid: @default_nid, content: "But this doesn't mean anything bad about Mike." } ], diff --git a/test/support/internal_tree_test_helpers.ex b/test/support/internal_tree_test_helpers.ex index 9e4f33a..0587cc9 100644 --- a/test/support/internal_tree_test_helpers.ex +++ b/test/support/internal_tree_test_helpers.ex @@ -1,28 +1,28 @@ defmodule Outlook.InternalTreeTestHelpers do - @default_uuid "11111111-1111-1111-1111-111111111111" + @default_nid "xxxxxx" alias Outlook.InternalTree.{InternalNode,TranslationUnit} - @doc "Set uuids to default value to make test results predictable." - def unify_uuids_in_tunits([ %TranslationUnit{} = node | rest ]) do + @doc "Set nids to default value to make test results predictable." + def unify_nids_in_tunits([ %TranslationUnit{} = node | rest ]) do [ %TranslationUnit{node | - uuid: @default_uuid, - content: String.replace(node.content, ~r/ uuid=""/, "") + nid: @default_nid, + content: String.replace(node.content, ~r/ nid=""/, "") } - | unify_uuids_in_tunits(rest) ] + | unify_nids_in_tunits(rest) ] end - def unify_uuids_in_tunits([ %InternalNode{type: :element} = node | rest ]) do + def unify_nids_in_tunits([ %InternalNode{type: :element} = node | rest ]) do [ %InternalNode{node | - content: unify_uuids_in_tunits(node.content) + content: unify_nids_in_tunits(node.content) } - | unify_uuids_in_tunits(rest) ] + | unify_nids_in_tunits(rest) ] end - def unify_uuids_in_tunits([ %InternalNode{} = node | rest ]) do - [ node | unify_uuids_in_tunits(rest) ] + def unify_nids_in_tunits([ %InternalNode{} = node | rest ]) do + [ node | unify_nids_in_tunits(rest) ] end - def unify_uuids_in_tunits([]), do: [] + def unify_nids_in_tunits([]), do: [] end