mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 00:18:27 +00:00
27 lines
639 B
Go
27 lines
639 B
Go
package license
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/fleetdm/fleet/v4/server/fleet"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestIsPremium(t *testing.T) {
|
|
cases := []struct {
|
|
desc string
|
|
ctx context.Context
|
|
want bool
|
|
}{
|
|
{"no license", context.Background(), false},
|
|
{"free license", NewContext(context.Background(), &fleet.LicenseInfo{Tier: fleet.TierFree}), false},
|
|
{"premium license", NewContext(context.Background(), &fleet.LicenseInfo{Tier: fleet.TierPremium}), true},
|
|
}
|
|
for _, c := range cases {
|
|
t.Run(c.desc, func(t *testing.T) {
|
|
got := IsPremium(c.ctx)
|
|
require.Equal(t, c.want, got)
|
|
})
|
|
}
|
|
}
|