Cleanup some code

This commit is contained in:
Thelonius Kort
2023-01-04 15:27:30 +01:00
parent 9a7dc7cf80
commit 49b72cbf68
2 changed files with 10 additions and 7 deletions

View File

@ -5,13 +5,11 @@ defmodule Outlook.InternalTreeTest do
describe "internal_tree" do
alias Outlook.InternalTree
alias Outlook.InternalTree.{InternalNode,Html,Basic,TranslationUnit}
import Outlook.ArticlesFixtures
alias Outlook.InternalTree.{InternalNode,TranslationUnit}
@default_uuid "11111111-1111-1111-1111-111111111111"
test "partition_text/1 returns correctly dingens..." do
test "partition_text/1 returns correctly partitioned text without overlapping markup" do
tree = [
%InternalNode{
name: "p",
@ -79,14 +77,19 @@ defmodule Outlook.InternalTreeTest do
eph: %{sibling_with: :block}
}
]
assert InternalTree.partition_text(tree) |> unify_uuids_in_tunits() == [
%InternalNode{name: "p", attributes: %{}, type: :element, uuid: "8293da39-18e3-4695-8ec5-a3a4a06f006c",
content: [
%TranslationUnit{status: :untranslated, uuid: @default_uuid,
content: "A sentence with many letters <a href=\"dingsda.com\">and many, many <b>words. </b></a>"},
%TranslationUnit{status: :untranslated, uuid: @default_uuid,
content: "<a href=\"dingsda.com\"><b>A</b> sentence</a> with many letters and many, many words. "}],
eph: %{sibling_with: :block}}]
content: "<a href=\"dingsda.com\"><b>A</b> sentence</a> with many letters and many, many words. "}
],
eph: %{sibling_with: :block}
}
]
end
test "partition_text/1 doesn't split numbers and abbreviated names" do
tree = [