Update tests to use nanoids
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user