-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathsetup.go
More file actions
30 lines (24 loc) · 795 Bytes
/
setup.go
File metadata and controls
30 lines (24 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (C) 2022, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package testutils
import (
"io"
"testing"
"github.com/ava-labs/avalanche-cli/pkg/application"
"github.com/ava-labs/avalanche-cli/pkg/config"
"github.com/ava-labs/avalanche-cli/pkg/ux"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/stretchr/testify/require"
)
func SetupTest(t *testing.T) *require.Assertions {
// use io.Discard to not print anything
ux.NewUserLog(logging.NoLog{}, io.Discard)
return require.New(t)
}
func SetupTestInTempDir(t *testing.T) *application.Avalanche {
testDir := t.TempDir()
app := application.New()
app.Setup(testDir, logging.NoLog{}, &config.Config{}, "", nil, nil, nil)
ux.NewUserLog(logging.NoLog{}, io.Discard)
return app
}