-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcommon_test.go
More file actions
78 lines (57 loc) · 1.83 KB
/
common_test.go
File metadata and controls
78 lines (57 loc) · 1.83 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package designer
import (
"github.com/stretchr/testify/suite"
"github.com/v8platform/designer/tests"
"github.com/v8platform/errors"
"github.com/v8platform/runner"
"path"
"testing"
)
type designerTestSuite struct {
tests.TestSuite
}
func TestDesigner(t *testing.T) {
suite.Run(t, new(designerTestSuite))
}
func (t *designerTestSuite) TestLoadCfg() {
confFile := path.Join(t.Pwd, "..", "tests", "fixtures", "0.9", "1Cv8.cf")
err := runner.Run(tests.NewFileIB(t.TempIB), LoadCfgOptions{
Designer: NewDesigner(),
File: confFile},
runner.WithTimeout(30))
t.R().NoError(err, errors.GetErrorContext(err))
}
func (t *designerTestSuite) TestLoadCfgWithUpdateCfgDB() {
confFile := path.Join(t.Pwd, "..", "tests", "fixtures", "0.9", "1Cv8.cf")
loadCfg := LoadCfgOptions{
Designer: NewDesigner(),
File: confFile,
UpdateDBCfg: &UpdateDBCfgOptions{
Dynamic: false,
},
}
err := runner.Run(tests.NewFileIB(t.TempIB), loadCfg,
runner.WithTimeout(30),
)
t.R().NoError(err, errors.GetErrorContext(err))
}
func (t *designerTestSuite) TestUpdateCfg() {
confFile := path.Join(t.Pwd, "..", "tests", "fixtures", "0.9", "1Cv8.cf")
loadCfg := LoadCfgOptions{
Designer: NewDesigner(),
File: confFile,
}.WithUpdateDBCfg(UpdateDBCfgOptions{})
err := runner.Run(tests.NewFileIB(t.TempIB), loadCfg,
runner.WithTimeout(30))
t.R().NoError(err, errors.GetErrorContext(err))
confFile2 := path.Join(t.Pwd, "..", "tests", "fixtures", "1.0", "1Cv8.cf")
task := UpdateCfgOptions{
Designer: NewDesigner(),
File: confFile2,
}
err = runner.Run(tests.NewFileIB(t.TempIB), task,
runner.WithTimeout(30))
t.R().NoError(err, errors.GetErrorContext(err))
//t.R().Equal(len(codes), 1, "Промокод должен быть START")
//t.R().Equal(codes[0].PromocodeID, "START", "Промокод должен быть START")
}