Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit fca4143

Browse files
author
noah
committed
Add a test for 'license.go'
1 parent 9fab85a commit fca4143

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package interactor
2+
3+
import (
4+
"context"
5+
"testing"
6+
7+
"github.com/gitploy-io/gitploy/internal/interactor/mock"
8+
"github.com/gitploy-io/gitploy/vo"
9+
"github.com/golang/mock/gomock"
10+
)
11+
12+
func TestStore_GetLicense(t *testing.T) {
13+
t.Run("Return the trial license when the signing data is nil.", func(t *testing.T) {
14+
ctrl := gomock.NewController(t)
15+
store := mock.NewMockStore(ctrl)
16+
17+
t.Log("MOCK - return the count of users.")
18+
store.
19+
EXPECT().
20+
CountUsers(gomock.AssignableToTypeOf(context.Background())).
21+
Return(5, nil)
22+
23+
i := &Interactor{Store: store}
24+
25+
lic, err := i.GetLicense(context.Background())
26+
if err != nil {
27+
t.Fatalf("GetLicense returns an error: %s", err)
28+
}
29+
30+
if !lic.IsTrial() {
31+
t.Fatalf("GetLicense = %v, wanted %v", lic.Kind, vo.LicenseKindTrial)
32+
}
33+
})
34+
}

0 commit comments

Comments
 (0)