@@ -9,12 +9,36 @@ module Exceptionless {
99 } ) ;
1010
1111 it ( 'should set the api key and enabled to true' , ( ) => {
12- var config = new Configuration ( 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw' , 'http://localhost:50000' ) ;
12+ var config = new Configuration ( { apiKey : 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw' , serverUrl : 'http://localhost:50000' } ) ;
1313 expect ( config ) . not . toBe ( null ) ;
1414 expect ( config . apiKey ) . toBe ( 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw' ) ;
1515 expect ( config . enabled ) . toBe ( true ) ;
1616 } ) ;
1717
18+ it ( 'should override configuration defaults' , ( ) => {
19+ var config = new Configuration ( ) ;
20+ expect ( config . apiKey ) . toBe ( null ) ;
21+ expect ( config . enabled ) . toBe ( false ) ;
22+
23+ Configuration . defaults . apiKey = 'test' ;
24+ config = new Configuration ( ) ;
25+ expect ( config . apiKey ) . toBe ( 'test' ) ;
26+ expect ( config . enabled ) . toBe ( true ) ;
27+
28+ config = new Configuration ( { apiKey :'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw' , serverUrl :'http://localhost:50000' } ) ;
29+ expect ( config . apiKey ) . toBe ( 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw' ) ;
30+ expect ( config . enabled ) . toBe ( true ) ;
31+
32+ config = new Configuration ( { apiKey :null } ) ;
33+ expect ( config . apiKey ) . toBe ( 'test' ) ;
34+ expect ( config . enabled ) . toBe ( true ) ;
35+
36+ delete Configuration . defaults . apiKey ;
37+ var config = new Configuration ( ) ;
38+ expect ( config . apiKey ) . toBe ( null ) ;
39+ expect ( config . enabled ) . toBe ( false ) ;
40+ } ) ;
41+
1842 it ( 'apply client configuration' , ( ) => {
1943 var config = new Configuration ( null ) ;
2044 expect ( config . apiKey ) . toBe ( null ) ;
@@ -26,7 +50,7 @@ module Exceptionless {
2650 } ) ;
2751
2852 it ( 'should not add duplicate plugin' , ( ) => {
29- var config = new Configuration ( 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw' ) ;
53+ var config = new Configuration ( { apiKey : 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw' , serverUrl : 'http://localhost:50000' } ) ;
3054 expect ( config . plugins ) . not . toBe ( null ) ;
3155 while ( config . plugins . length > 0 ) {
3256 config . removePlugin ( config . plugins [ 0 ] ) ;
@@ -38,7 +62,7 @@ module Exceptionless {
3862 } ) ;
3963
4064 it ( 'should generate plugin name and priority' , ( ) => {
41- var config = new Configuration ( 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw' ) ;
65+ var config = new Configuration ( { apiKey : 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw' , serverUrl : 'http://localhost:50000' } ) ;
4266 expect ( config . plugins ) . not . toBe ( null ) ;
4367 while ( config . plugins . length > 0 ) {
4468 config . removePlugin ( config . plugins [ 0 ] ) ;
@@ -51,7 +75,7 @@ module Exceptionless {
5175 } ) ;
5276
5377 it ( 'should sort plugins by priority' , ( ) => {
54- var config = new Configuration ( 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw' ) ;
78+ var config = new Configuration ( { apiKey : 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw' , serverUrl : 'http://localhost:50000' } ) ;
5579 expect ( config . plugins ) . not . toBe ( null ) ;
5680 while ( config . plugins . length > 0 ) {
5781 config . removePlugin ( config . plugins [ 0 ] ) ;
0 commit comments