chore: make tests pass

This commit is contained in:
Vilsol 2022-10-14 20:43:17 +03:00
parent 824a94b9b7
commit 815c8a3c57
2 changed files with 8 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"sort" "sort"
"strings"
"github.com/Khan/genqlient/graphql" "github.com/Khan/genqlient/graphql"
"github.com/Masterminds/semver/v3" "github.com/Masterminds/semver/v3"
@ -119,9 +120,14 @@ func (r *resolvingInstance) Step() error {
return errors.Errorf("could not find an SML version that matches constraint %s and game version %d", constraint, r.GameVersion) return errors.Errorf("could not find an SML version that matches constraint %s and game version %d", constraint, r.GameVersion)
} }
smlVersionStr := chosenSMLVersion.String()
if !strings.HasPrefix(smlVersionStr, "v") {
smlVersionStr = "v" + smlVersionStr
}
r.OutputLock[id] = LockedMod{ r.OutputLock[id] = LockedMod{
Version: chosenSMLVersion.String(), Version: chosenSMLVersion.String(),
Link: fmt.Sprintf(smlDownloadTemplate, chosenSMLVersion.String()), Link: fmt.Sprintf(smlDownloadTemplate, smlVersionStr),
Dependencies: map[string]string{}, Dependencies: map[string]string{},
} }
} }

View file

@ -41,7 +41,7 @@ func TestProfileResolution(t *testing.T) {
}, },
}).Resolve(resolver, nil, math.MaxInt) }).Resolve(resolver, nil, math.MaxInt)
testza.AssertEqual(t, "failed resolving profile dependencies: failed resolving dependencies. requires different versions of RefinedRDLib", err.Error()) testza.AssertEqual(t, "failed resolving profile dependencies: mod RefinedRDLib version 1.0.6 does not match constraint ^1.0.7", err.Error())
_, err = (&Profile{ _, err = (&Profile{
Name: DefaultProfileName, Name: DefaultProfileName,