github.com/easysoft/zendata@v0.0.0-20240513203326-705bd5a7fd67/cmd/test/command/cmd_data_view_test.go (about) 1 package main 2 3 import ( 4 "testing" 5 6 "github.com/easysoft/zendata/cmd/test/consts" 7 testHelper "github.com/easysoft/zendata/cmd/test/helper" 8 "github.com/easysoft/zendata/internal/pkg/helper" 9 "github.com/ozontech/allure-go/pkg/framework/provider" 10 "github.com/ozontech/allure-go/pkg/framework/suite" 11 ) 12 13 func TestDataViewCmd(t *testing.T) { 14 suite.RunSuite(t, new(DataViewCmdSuite)) 15 } 16 17 type DataViewCmdSuite struct { 18 suite.Suite 19 } 20 21 func (s *DataViewCmdSuite) BeforeAll(t provider.T) { 22 testHelper.BeforeAll() 23 t.AddSubSuite("DataListCmd") 24 } 25 func (s *DataViewCmdSuite) BeforeEach(t provider.T) { 26 testHelper.PreCase() 27 t.AddSubSuite("DataViewCmd") 28 } 29 func (s *DataViewCmdSuite) AfterEach(t provider.T) { 30 testHelper.PostCase() 31 } 32 33 func (s *DataViewCmdSuite) TestViewDataBuildinExcel(t provider.T) { 34 t.ID("0") 35 36 consts.Buf.Reset() 37 helper.View("city.v1.city") 38 out := consts.Buf.String() 39 t.Require().Contains(out, "北京市", "check excel content") 40 } 41 42 func (s *DataViewCmdSuite) TestViewDataBuildinConfig(t provider.T) { 43 t.ID("0") 44 45 consts.Buf.Reset() 46 helper.View("color/v1.yaml") 47 out := consts.Buf.String() 48 t.Require().Contains(out, "rgb", "check excel content") 49 50 consts.Buf.Reset() 51 helper.View("color.v1.yaml") 52 out = consts.Buf.String() 53 54 t.Require().Contains(out, "rgb", "check excel content") 55 }