github.com/easysoft/zendata@v0.0.0-20240513203326-705bd5a7fd67/cmd/test/command/cmd_gen_article_test.go (about)

     1  package main
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/easysoft/zendata/cmd/test/consts"
     7  	"github.com/easysoft/zendata/cmd/test/gen"
     8  	testHelper "github.com/easysoft/zendata/cmd/test/helper"
     9  	"github.com/ozontech/allure-go/pkg/framework/provider"
    10  	"github.com/ozontech/allure-go/pkg/framework/suite"
    11  )
    12  
    13  func TestGenerateArticleCmd(t *testing.T) {
    14  	suite.RunSuite(t, new(GenerateArticleCmdSuite))
    15  }
    16  
    17  type GenerateArticleCmdSuite struct {
    18  	suite.Suite
    19  }
    20  
    21  func (s *GenerateArticleCmdSuite) BeforeAll(t provider.T) {
    22  	testHelper.BeforeAll()
    23  	t.AddSubSuite("GenerateArticleCmd")
    24  }
    25  func (s *GenerateArticleCmdSuite) BeforeEach(t provider.T) {
    26  	testHelper.PreCase()
    27  	t.AddSubSuite("GenerateArticleCmd")
    28  }
    29  func (s *GenerateArticleCmdSuite) AfterEach(t provider.T) {
    30  	testHelper.PostCase()
    31  }
    32  
    33  func (s *GenerateArticleCmdSuite) TestGenerateArticle(t provider.T) {
    34  	t.ID("0")
    35  
    36  	out := gen.New().
    37  		SetConfigs([]string{consts.CommandTestFileArticleConfig}).
    38  		SetOutput(consts.CommandTestFileArticleOut).
    39  		Gen()
    40  
    41  	t.Require().NotContains(out, "{人称代词}", "check generated data")
    42  }