11package tools
22
33import (
4+ "codacy/cli-v2/domain"
45 "testing"
56
67 "github.com/stretchr/testify/assert"
78)
89
9- func testConfig (t * testing.T , configuration ToolConfiguration , expected string ) {
10+ func testConfig (t * testing.T , configuration []domain. PatternConfiguration , expected string ) {
1011 actual := CreateEslintConfig (configuration )
1112 assert .Equal (t , expected , actual )
1213}
1314
1415func TestCreateEslintConfigEmptyConfig (t * testing.T ) {
1516 testConfig (t ,
16- ToolConfiguration {},
17+ []domain. PatternConfiguration {},
1718 `export default [
1819 {
1920 rules: {
@@ -24,10 +25,10 @@ func TestCreateEslintConfigEmptyConfig(t *testing.T) {
2425
2526func TestCreateEslintConfigConfig1 (t * testing.T ) {
2627 testConfig (t ,
27- ToolConfiguration {
28- PatternsConfiguration : [] PatternConfiguration {
29- {
30- PatternId : "ESLint8_semi" ,
28+ []domain. PatternConfiguration {
29+ {
30+ PatternDefinition : domain. PatternDefinition {
31+ Id : "ESLint8_semi" ,
3132 },
3233 },
3334 },
@@ -42,15 +43,15 @@ func TestCreateEslintConfigConfig1(t *testing.T) {
4243
4344func TestCreateEslintConfigUnnamedParam (t * testing.T ) {
4445 testConfig (t ,
45- ToolConfiguration {
46- PatternsConfiguration : [] PatternConfiguration {
47- {
48- PatternId : "ESLint8_semi" ,
49- ParameterConfigurations : [] PatternParameterConfiguration {
50- {
51- Name : "unnamedParam" ,
52- Value : "never " ,
53- } ,
46+ []domain. PatternConfiguration {
47+ {
48+ PatternDefinition : domain. PatternDefinition {
49+ Id : "ESLint8_semi" ,
50+ },
51+ Parameters : []domain. ParameterConfiguration {
52+ {
53+ Name : "unnamedParam " ,
54+ Value : "never" ,
5455 },
5556 },
5657 },
@@ -66,15 +67,15 @@ func TestCreateEslintConfigUnnamedParam(t *testing.T) {
6667
6768func TestCreateEslintConfigNamedParam (t * testing.T ) {
6869 testConfig (t ,
69- ToolConfiguration {
70- PatternsConfiguration : [] PatternConfiguration {
71- {
72- PatternId : "consistent-return" ,
73- ParameterConfigurations : [] PatternParameterConfiguration {
74- {
75- Name : "treatUndefinedAsUnspecified" ,
76- Value : "false " ,
77- } ,
70+ []domain. PatternConfiguration {
71+ {
72+ PatternDefinition : domain. PatternDefinition {
73+ Id : "consistent-return" ,
74+ },
75+ Parameters : []domain. ParameterConfiguration {
76+ {
77+ Name : "treatUndefinedAsUnspecified " ,
78+ Value : "false" ,
7879 },
7980 },
8081 },
@@ -90,19 +91,19 @@ func TestCreateEslintConfigNamedParam(t *testing.T) {
9091
9192func TestCreateEslintConfigUnnamedAndNamedParam (t * testing.T ) {
9293 testConfig (t ,
93- ToolConfiguration {
94- PatternsConfiguration : [] PatternConfiguration {
95- {
96- PatternId : "consistent-return" ,
97- ParameterConfigurations : [] PatternParameterConfiguration {
98- {
99- Name : "treatUndefinedAsUnspecified" ,
100- Value : "false " ,
101- } ,
102- {
103- Name : "unnamedParam" ,
104- Value : "foo " ,
105- } ,
94+ []domain. PatternConfiguration {
95+ {
96+ PatternDefinition : domain. PatternDefinition {
97+ Id : "consistent-return" ,
98+ },
99+ Parameters : []domain. ParameterConfiguration {
100+ {
101+ Name : "treatUndefinedAsUnspecified " ,
102+ Value : "false" ,
103+ },
104+ {
105+ Name : "unnamedParam " ,
106+ Value : "foo" ,
106107 },
107108 },
108109 },
@@ -118,10 +119,10 @@ func TestCreateEslintConfigUnnamedAndNamedParam(t *testing.T) {
118119
119120func TestCreateEslintConfigSupportPlugins (t * testing.T ) {
120121 testConfig (t ,
121- ToolConfiguration {
122- PatternsConfiguration : [] PatternConfiguration {
123- {
124- PatternId : "plugin/consistent-return" ,
122+ []domain. PatternConfiguration {
123+ {
124+ PatternDefinition : domain. PatternDefinition {
125+ Id : "plugin/consistent-return" ,
125126 },
126127 },
127128 },
0 commit comments