@@ -17,3 +17,51 @@ func TestInteractor_IsAdminUser(t *testing.T) {
1717 }
1818 })
1919}
20+
21+ func TestInteractor_IsEntryMember (t * testing.T ) {
22+ t .Run ("Return false when the user's login is not included." , func (t * testing.T ) {
23+ i := & Interactor {
24+ memberEntries : []string {"octocat" },
25+ }
26+
27+ want := false
28+ if ret := i .IsEntryMember (context .Background (), "coco" ); ret != want {
29+ t .Fatalf ("IsEntryMember = %v, wanted %v" , ret , want )
30+ }
31+ })
32+
33+ t .Run ("Return true when the user's login is included." , func (t * testing.T ) {
34+ i := & Interactor {
35+ memberEntries : []string {"octocat" },
36+ }
37+
38+ want := true
39+ if ret := i .IsEntryMember (context .Background (), "octocat" ); ret != want {
40+ t .Fatalf ("IsEntryMember = %v, wanted %v" , ret , want )
41+ }
42+ })
43+ }
44+
45+ func TestInteractor_IsOrgMember (t * testing.T ) {
46+ t .Run ("Return false when the org is not included." , func (t * testing.T ) {
47+ i := & Interactor {
48+ memberEntries : []string {"gitploy-io" },
49+ }
50+
51+ want := false
52+ if ret := i .IsOrgMember (context .Background (), []string {"github" }); ret != want {
53+ t .Fatalf ("IsEntryMember = %v, wanted %v" , ret , want )
54+ }
55+ })
56+
57+ t .Run ("Return true when the org is included." , func (t * testing.T ) {
58+ i := & Interactor {
59+ memberEntries : []string {"gitploy-io" },
60+ }
61+
62+ want := true
63+ if ret := i .IsOrgMember (context .Background (), []string {"gitploy-io" }); ret != want {
64+ t .Fatalf ("IsEntryMember = %v, wanted %v" , ret , want )
65+ }
66+ })
67+ }
0 commit comments