-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathfilter_flags_test.go
56 lines (44 loc) · 1.36 KB
/
filter_flags_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package gedcom_test
import (
"testing"
"github.com/elliotchance/gedcom/v39"
"github.com/stretchr/testify/assert"
)
func TestFilterFlags_Filter(t *testing.T) {
t.Run("NoDuplicateNames", func(t *testing.T) {
doc1 := gedcom.NewDocument()
doc1.AddIndividual("P1",
gedcom.NewNameNode("Bob /Smith/"),
gedcom.NewNameNode("Jane /Smith/"),
gedcom.NewNameNode("Bob /Smith/"))
doc2 := gedcom.NewDocument()
doc2.AddIndividual("P1",
gedcom.NewNameNode("Bob /Smith/"),
gedcom.NewNameNode("Jane /Smith/"))
ff := &gedcom.FilterFlags{
NoDuplicateNames: true,
NameFormat: "unmodified",
}
doc := gedcom.NewDocument()
assert.Equal(t, doc2.Nodes()[0].GEDCOMString(0),
ff.Filter(doc1.Nodes()[0], doc).GEDCOMString(0))
})
t.Run("NoDuplicateNamesWithModifiedNames", func(t *testing.T) {
doc1 := gedcom.NewDocument()
doc1.AddIndividual("P1",
gedcom.NewNameNode("Bob /Smith/"),
gedcom.NewNameNode("Jane /Smith/"),
gedcom.NewNameNode("Bob /Smith/"))
doc2 := gedcom.NewDocument()
doc2.AddIndividual("P1",
gedcom.NewNameNode("Bob /Smith/"),
gedcom.NewNameNode("Jane /Smith/"))
ff := &gedcom.FilterFlags{
NoDuplicateNames: true,
NameFormat: string(gedcom.NameFormatGEDCOM),
}
doc := gedcom.NewDocument()
assert.Equal(t, doc2.Nodes()[0].GEDCOMString(0),
ff.Filter(doc1.Nodes()[0], doc).GEDCOMString(0))
})
}