1package interactors 2 3import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 8 cst "repodiff/constants" 9 ent "repodiff/entities" 10 "repodiff/persistence/filesystem" 11) 12 13func TestProjectNamesToType(t *testing.T) { 14 var common, downstream, upstream ent.ManifestFile 15 filesystem.ReadXMLAsEntity("testdata/common_manifest.xml", &common) 16 filesystem.ReadXMLAsEntity("testdata/downstream_manifest.xml", &downstream) 17 filesystem.ReadXMLAsEntity("testdata/upstream_manifest.xml", &upstream) 18 19 nameToType := ProjectNamesToType( 20 &ent.ManifestFileGroup{ 21 Common: common, 22 Upstream: upstream, 23 Downstream: downstream, 24 }, 25 ) 26 assert.Equal(t, 777, len(nameToType), "expected") 27 28 distinctCount := 0 29 for _, projectType := range nameToType { 30 if projectType == cst.DifferentialSpecific { 31 distinctCount++ 32 } 33 } 34 assert.Equal(t, 153, distinctCount, "Expected count of distinct project names") 35} 36