@@ -13,29 +13,26 @@ describe("convertEditorSettings", () => {
1313 } ;
1414
1515 // Act
16- const { converted, missing, failed } = convertEditorSettings (
17- { converters } ,
18- editorConfiguration ,
19- ) ;
16+ const result = convertEditorSettings ( { converters } , editorConfiguration ) ;
2017
2118 // Assert
22- expect ( converted . size ) . toEqual ( 0 ) ;
23- expect ( missing . length ) . toEqual ( 0 ) ;
24- expect ( failed . length ) . toEqual ( 0 ) ;
19+ expect ( result ) . toEqual ( {
20+ converted : new Map ( ) ,
21+ failed : [ ] ,
22+ missing : [ ] ,
23+ } ) ;
2524 } ) ;
2625
2726 it ( "skips a configuration if not an editor setting" , ( ) => {
2827 // Arrange
29- const conversionResult : EditorSettingConversionResult = {
28+ const { editorSetting , converters } = setupConversionEnvironment ( {
3029 settings : [
3130 {
3231 editorSettingName : "editor.eslint-setting-a" ,
3332 value : "a" ,
3433 } ,
3534 ] ,
36- } ;
37-
38- const { editorSetting, converters } = setupConversionEnvironment ( conversionResult ) ;
35+ } ) ;
3936
4037 const editorConfiguration = {
4138 notAnEditorSetting : "a" ,
@@ -44,29 +41,40 @@ describe("convertEditorSettings", () => {
4441 } ;
4542
4643 // Act
47- const { converted, missing, failed } = convertEditorSettings (
48- { converters } ,
49- editorConfiguration ,
50- ) ;
44+ const result = convertEditorSettings ( { converters } , editorConfiguration ) ;
5145
5246 // Assert
53- expect ( converted . size ) . toEqual ( 1 ) ;
54- expect ( missing . length ) . toEqual ( 0 ) ;
55- expect ( failed . length ) . toEqual ( 0 ) ;
47+ expect ( result ) . toEqual ( {
48+ converted : new Map ( [
49+ [
50+ "editor.eslint-setting-a" ,
51+ {
52+ editorSettingName : "editor.eslint-setting-a" ,
53+ value : "a" ,
54+ } ,
55+ ] ,
56+ ] ) ,
57+ failed : [ ] ,
58+ missing : [ ] ,
59+ } ) ;
5660 } ) ;
5761
5862 it ( "marks a setting as missing when its converter returns undefined" , ( ) => {
5963 // Arrange
6064 const { editorSetting, converters } = setupConversionEnvironment ( ) ;
6165
6266 // Act
63- const { missing } = convertEditorSettings (
67+ const result = convertEditorSettings (
6468 { converters } ,
6569 { [ editorSetting . editorSettingName ] : editorSetting } ,
6670 ) ;
6771
6872 // Assert
69- expect ( missing ) . toEqual ( [ { editorSettingName : editorSetting . editorSettingName } ] ) ;
73+ expect ( result ) . toEqual ( {
74+ converted : new Map ( ) ,
75+ failed : [ ] ,
76+ missing : [ { editorSettingName : editorSetting . editorSettingName } ] ,
77+ } ) ;
7078 } ) ;
7179
7280 it ( "marks a conversion as failed when returned a conversion error" , ( ) => {
@@ -76,45 +84,50 @@ describe("convertEditorSettings", () => {
7684 converters . set ( editorSetting . editorSettingName , ( ) => conversionError ) ;
7785
7886 // Act
79- const { failed } = convertEditorSettings (
87+ const result = convertEditorSettings (
8088 { converters } ,
8189 { [ editorSetting . editorSettingName ] : editorSetting } ,
8290 ) ;
8391
8492 // Assert
85- expect ( failed ) . toEqual ( [ conversionError ] ) ;
93+ expect ( result ) . toEqual ( {
94+ converted : new Map ( ) ,
95+ failed : [ conversionError ] ,
96+ missing : [ ] ,
97+ } ) ;
8698 } ) ;
8799
88100 it ( "marks a converted setting name as converted when a conversion has settings" , ( ) => {
89101 // Arrange
90- const conversionResult : EditorSettingConversionResult = {
102+ const { editorSetting , converters } = setupConversionEnvironment ( {
91103 settings : [
92104 {
93- editorSettingName : "editor. eslint-setting-a " ,
105+ editorSettingName : "eslint.configFile " ,
94106 value : "a" ,
95107 } ,
96108 ] ,
97- } ;
98- const { editorSetting, converters } = setupConversionEnvironment ( conversionResult ) ;
109+ } ) ;
99110
100111 // Act
101- const { converted } = convertEditorSettings (
112+ const result = convertEditorSettings (
102113 { converters } ,
103114 { [ editorSetting . editorSettingName ] : editorSetting . value } ,
104115 ) ;
105116
106117 // Assert
107- expect ( converted ) . toEqual (
108- new Map ( [
118+ expect ( result ) . toEqual ( {
119+ converted : new Map ( [
109120 [
110- "editor. eslint-setting-a " ,
121+ "eslint.configFile " ,
111122 {
112- editorSettingName : "editor. eslint-setting-a " ,
123+ editorSettingName : "eslint.configFile " ,
113124 value : "a" ,
114125 } ,
115126 ] ,
116127 ] ) ,
117- ) ;
128+ failed : [ ] ,
129+ missing : [ ] ,
130+ } ) ;
118131 } ) ;
119132} ) ;
120133
@@ -127,7 +140,7 @@ function setupConversionEnvironment(conversionResult?: EditorSettingConversionRe
127140
128141function createSampleEditorSetting ( ) : EditorSetting {
129142 return {
130- editorSettingName : "editor. tslint-editor-setting-a " ,
143+ editorSettingName : "tslint.configFile " ,
131144 value : "a" ,
132145 } ;
133146}
0 commit comments