@@ -16,28 +16,24 @@ import (
1616 "github.com/stretchr/testify/require"
1717)
1818
19- func TestLinkedRepository (t * testing.T ) {
19+ func TestAttachLinkedType (t * testing.T ) {
2020 assert .NoError (t , unittest .PrepareTestDatabase ())
2121 testCases := []struct {
2222 name string
2323 attachID int64
24- expectedRepo * repo_model.Repository
2524 expectedUnitType unit.Type
2625 }{
27- {"LinkedIssue" , 1 , & repo_model. Repository { ID : 1 }, unit .TypeIssues },
28- {"LinkedComment" , 3 , & repo_model. Repository { ID : 1 }, unit .TypePullRequests },
29- {"LinkedRelease" , 9 , & repo_model. Repository { ID : 1 }, unit .TypeReleases },
30- {"Notlinked" , 10 , nil , - 1 },
26+ {"LinkedIssue" , 1 , unit .TypeIssues },
27+ {"LinkedComment" , 3 , unit .TypePullRequests },
28+ {"LinkedRelease" , 9 , unit .TypeReleases },
29+ {"Notlinked" , 10 , unit . TypeInvalid },
3130 }
3231 for _ , tc := range testCases {
3332 t .Run (tc .name , func (t * testing.T ) {
3433 attach , err := repo_model .GetAttachmentByID (t .Context (), tc .attachID )
3534 assert .NoError (t , err )
36- repo , unitType , err := LinkedRepository (t .Context (), attach )
35+ unitType , err := GetAttachmentLinkedType (t .Context (), attach )
3736 assert .NoError (t , err )
38- if tc .expectedRepo != nil {
39- assert .Equal (t , tc .expectedRepo .ID , repo .ID )
40- }
4137 assert .Equal (t , tc .expectedUnitType , unitType )
4238 })
4339 }
0 commit comments