File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -188,27 +188,21 @@ async function parseV1SocketConfig (parsedV1Content) {
188188 return v2
189189}
190190
191- /**
192- *
193- * @returns {SocketYml }
194- */
191+ /** @returns {SocketYml } */
195192function getDefaultConfig ( ) {
196193 const config = { version : 2 }
194+
197195 if ( ! validate ( config ) ) {
198- throw new SocketValidationError (
199- 'Invalid config definition' ,
200- validate . errors || [ ] ,
201- config
202- )
196+ throw new Error ( 'Unexpectedly invalid default config' )
203197 }
204198
205199 return config
206200}
207201
208202module . exports = {
203+ getDefaultConfig,
209204 parseSocketConfig,
210205 readSocketConfig,
211206 SocketValidationError,
212207 socketYmlSchema,
213- getDefaultConfig
214208}
Original file line number Diff line number Diff line change @@ -7,14 +7,17 @@ const chai = require('chai')
77const chaiAsPromised = require ( 'chai-as-promised' )
88
99const {
10+ getDefaultConfig,
1011 parseSocketConfig,
1112 SocketValidationError,
1213} = require ( '../index.js' )
1314
1415chai . use ( chaiAsPromised )
1516chai . should ( )
1617
18+ /** @type {import('../index.js').SocketYml } */
1719const defaults = {
20+ 'version' : 2 ,
1821 'githubApp' : {
1922 'enabled' : true ,
2023 'projectReportsEnabled' : true ,
@@ -82,7 +85,7 @@ bar: {{ def }} {{ efg }}
8285version: 2
8386foo: true
8487` )
85- . should . eventually . become ( { version : 2 , ... defaults } )
88+ . should . eventually . become ( defaults )
8689 } )
8790
8891 it ( 'should coerce types' , async ( ) => {
@@ -91,9 +94,14 @@ version: 2
9194projectIgnorePaths: foobar
9295` )
9396 . should . eventually . become ( {
94- version : 2 ,
9597 ...defaults ,
9698 projectIgnorePaths : [ 'foobar' ] ,
9799 } )
98100 } )
99101} )
102+
103+ describe ( 'getDefaultConfig()' , ( ) => {
104+ it ( 'should return a default config' , ( ) => {
105+ getDefaultConfig ( ) . should . deep . equal ( defaults )
106+ } )
107+ } )
You can’t perform that action at this time.
0 commit comments