mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-20 12:23:22 +00:00
Add complete integration test coverage for all CLI commands with isolated sandbox environments that run on every change. Changes: - Add testutil package for sandbox test infrastructure - Add 77 integration tests covering all commands (init, sync, status, diff, backup, restore, pull, doctor, target, version, help) - Update CI workflow to run integration tests on Ubuntu and macOS - Add SKILLSHARE_CONFIG env var support for test isolation - Add mise.toml for task management - Move scripts to scripts/ directory
55 lines
1.1 KiB
Go
55 lines
1.1 KiB
Go
package integration
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"skillshare/internal/testutil"
|
|
)
|
|
|
|
func TestHelp_ShowsUsage(t *testing.T) {
|
|
sb := testutil.NewSandbox(t)
|
|
defer sb.Cleanup()
|
|
|
|
result := sb.RunCLI("help")
|
|
result.AssertSuccess(t)
|
|
result.AssertOutputContains(t, "skillshare")
|
|
result.AssertOutputContains(t, "Usage:")
|
|
result.AssertOutputContains(t, "Commands:")
|
|
}
|
|
|
|
func TestHelp_ShortFlag(t *testing.T) {
|
|
sb := testutil.NewSandbox(t)
|
|
defer sb.Cleanup()
|
|
|
|
result := sb.RunCLI("-h")
|
|
result.AssertSuccess(t)
|
|
result.AssertOutputContains(t, "Usage:")
|
|
}
|
|
|
|
func TestHelp_LongFlag(t *testing.T) {
|
|
sb := testutil.NewSandbox(t)
|
|
defer sb.Cleanup()
|
|
|
|
result := sb.RunCLI("--help")
|
|
result.AssertSuccess(t)
|
|
result.AssertOutputContains(t, "Usage:")
|
|
}
|
|
|
|
func TestNoArgs_ShowsUsage(t *testing.T) {
|
|
sb := testutil.NewSandbox(t)
|
|
defer sb.Cleanup()
|
|
|
|
result := sb.RunCLI()
|
|
result.AssertFailure(t)
|
|
result.AssertOutputContains(t, "Usage:")
|
|
}
|
|
|
|
func TestUnknownCommand_ShowsError(t *testing.T) {
|
|
sb := testutil.NewSandbox(t)
|
|
defer sb.Cleanup()
|
|
|
|
result := sb.RunCLI("unknowncommand")
|
|
result.AssertFailure(t)
|
|
result.AssertAnyOutputContains(t, "Unknown command")
|
|
}
|