@@ -8,7 +8,10 @@ var Config = require('lib/config'),
88describe ( 'config' , function ( ) {
99 var VALID_OPTIONS = {
1010 system : {
11- projectRoot : '/some/path'
11+ projectRoot : '/some/path' ,
12+ plugins : {
13+ plugin : { }
14+ }
1215 } ,
1316 rootUrl : 'http://example.com/root' ,
1417 gridUrl : 'http://example.com/root' ,
@@ -225,6 +228,38 @@ describe('config', function() {
225228 } ) ;
226229 }
227230
231+ function testObjectOption ( name ) {
232+ it ( 'should parse any of primitive type from environment' , ( ) => {
233+ [ 'string' , 1.0 , 1 , false , null , [ ] , { a : 1 } ] . forEach ( ( expected ) => {
234+ const value = JSON . stringify ( expected ) ;
235+ assertParsesEnv ( { property : name , value, expected} ) ;
236+ } ) ;
237+ } ) ;
238+
239+ it ( 'should not throws if value from environment is not valid' , ( ) => {
240+ [ '{a:1}' , '{' , ']' , '\'string\'' , '\n' ] . forEach ( ( value ) => {
241+ assert . doesNotThrow ( ( ) => {
242+ assertParsesEnv ( { property : name , value} ) ;
243+ } ) ;
244+ } ) ;
245+ } ) ;
246+
247+ it ( 'should parse any of primitive type from cli' , ( ) => {
248+ [ 'string' , 1.0 , 1 , false , null , [ ] , { a : 1 } ] . forEach ( ( expected ) => {
249+ const value = JSON . stringify ( expected ) ;
250+ assertParsesCli ( { property : name , value, expected} ) ;
251+ } ) ;
252+ } ) ;
253+
254+ it ( 'should not throws if value from cli is not valid' , ( ) => {
255+ [ '{a:1}' , '{' , ']' , '\'string\'' , '\n' ] . forEach ( ( value ) => {
256+ assert . doesNotThrow ( ( ) => {
257+ assertParsesCli ( { property : name , value} ) ;
258+ } ) ;
259+ } ) ;
260+ } ) ;
261+ }
262+
228263 beforeEach ( function ( ) {
229264 this . sinon = sinon . sandbox . create ( ) ;
230265 } ) ;
@@ -439,6 +474,10 @@ describe('config', function() {
439474 } ) ;
440475 } ) ;
441476 } ) ;
477+
478+ describe . only ( 'plugins' , ( ) => {
479+ testObjectOption ( 'system.plugins.plugin' ) ;
480+ } ) ;
442481 } ) ;
443482
444483 describe ( 'browser options' , function ( ) {
0 commit comments