ficsit-cli-flake/cli/installations_test.go
Vilsol 4195463c60
feat: threaded download pooling (#48)
* feat: threaded download pooling
refactor: splice out resolver

* chore: remove debug
2023-12-16 13:59:58 +02:00

53 lines
1.2 KiB
Go

package cli
import (
"os"
"testing"
"github.com/MarvinJWendt/testza"
"github.com/satisfactorymodding/ficsit-cli/cfg"
)
func init() {
cfg.SetDefaults()
}
func TestInstallationsInit(t *testing.T) {
installations, err := InitInstallations()
testza.AssertNoError(t, err)
testza.AssertNotNil(t, installations)
}
func TestAddInstallation(t *testing.T) {
ctx, err := InitCLI(false)
testza.AssertNoError(t, err)
err = ctx.Wipe()
testza.AssertNoError(t, err)
err = ctx.ReInit()
testza.AssertNoError(t, err)
ctx.Provider = MockProvider{}
profileName := "InstallationTest"
profile, err := ctx.Profiles.AddProfile(profileName)
testza.AssertNoError(t, err)
testza.AssertNoError(t, profile.AddMod("AreaActions", "1.6.5"))
testza.AssertNoError(t, profile.AddMod("RefinedPower", "3.2.10"))
serverLocation := os.Getenv("SF_DEDICATED_SERVER")
if serverLocation != "" {
installation, err := ctx.Installations.AddInstallation(ctx, serverLocation, profileName)
testza.AssertNoError(t, err)
testza.AssertNotNil(t, installation)
err = installation.Install(ctx, installWatcher())
testza.AssertNoError(t, err)
installation.Vanilla = true
err = installation.Install(ctx, installWatcher())
testza.AssertNoError(t, err)
}
}