mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-18 18:04:17 +00:00
Boost unit test coverage across three core packages: - internal/sync: 11.6% → 54.6% (discovery, status, checksum, manifest, pull, merge/prune) - internal/install: 40.7% → 60.0% (meta, ignore, copy, updatable, local install, options, gitignore, source) - internal/server: 15.1% → 40.0% (health, overview, skills, targets, config, log, trash, sync, collect, check, backup, diff, audit, hub)
42 lines
956 B
Go
42 lines
956 B
Go
package install
|
|
|
|
import "testing"
|
|
|
|
func TestShouldInstallAll(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
opts InstallOptions
|
|
want bool
|
|
}{
|
|
{"default", InstallOptions{}, false},
|
|
{"all", InstallOptions{All: true}, true},
|
|
{"yes", InstallOptions{Yes: true}, true},
|
|
{"both", InstallOptions{All: true, Yes: true}, true},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := tt.opts.ShouldInstallAll(); got != tt.want {
|
|
t.Errorf("ShouldInstallAll() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestHasSkillFilter(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
opts InstallOptions
|
|
want bool
|
|
}{
|
|
{"empty", InstallOptions{}, false},
|
|
{"with filter", InstallOptions{Skills: []string{"a"}}, true},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := tt.opts.HasSkillFilter(); got != tt.want {
|
|
t.Errorf("HasSkillFilter() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|