mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 22:21:07 +03:00
parent
0e79446586
commit
7c9fada778
80 changed files with 1273 additions and 1082 deletions
|
@ -30,6 +30,7 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/gohugoio/hugo/common/loggers"
|
||||
"github.com/gohugoio/hugo/media"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
|
@ -197,7 +198,8 @@ func TestFindDiffs(t *testing.T) {
|
|||
for _, r := range tc.Remote {
|
||||
remote[r.Key] = r
|
||||
}
|
||||
gotUpdates, gotDeletes := findDiffs(local, remote, tc.Force)
|
||||
d := newDeployer()
|
||||
gotUpdates, gotDeletes := d.findDiffs(local, remote, tc.Force)
|
||||
gotUpdates = applyOrdering(nil, gotUpdates)[0]
|
||||
sort.Slice(gotDeletes, func(i, j int) bool { return gotDeletes[i] < gotDeletes[j] })
|
||||
if diff := cmp.Diff(gotUpdates, tc.WantUpdates, cmpopts.IgnoreUnexported(localFile{})); diff != "" {
|
||||
|
@ -249,7 +251,8 @@ func TestWalkLocal(t *testing.T) {
|
|||
fd.Close()
|
||||
}
|
||||
}
|
||||
if got, err := walkLocal(fs, nil, nil, nil, media.DefaultTypes); err != nil {
|
||||
d := newDeployer()
|
||||
if got, err := d.walkLocal(fs, nil, nil, nil, media.DefaultTypes); err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
expect := map[string]any{}
|
||||
|
@ -1026,3 +1029,9 @@ func verifyRemote(ctx context.Context, bucket *blob.Bucket, local []*fileData) (
|
|||
}
|
||||
return diff, nil
|
||||
}
|
||||
|
||||
func newDeployer() *Deployer {
|
||||
return &Deployer{
|
||||
logger: loggers.NewDefault(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue