File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -2099,6 +2099,15 @@ class Particle {
20992099 } ) ;
21002100 }
21012101
2102+ /**
2103+ * Set default auth token that will be used in each method if `auth` is not provided
2104+ * @param {String } auth A Particle access token
2105+ * @returns {undefined }
2106+ */
2107+ setDefaultAuth ( auth ) {
2108+ this . _defaultAuth = auth ;
2109+ }
2110+
21022111 /**
21032112 * API URI to access a device
21042113 * @param {Object } options Options for this API call
Original file line number Diff line number Diff line change @@ -2716,4 +2716,16 @@ describe('ParticleAPI', () => {
27162716 expect ( api . agent . setBaseUrl . firstCall . args [ 0 ] ) . to . eql ( baseUrl ) ;
27172717 } ) ;
27182718 } ) ;
2719+
2720+ describe ( 'setDefaultAuth(auth)' , ( ) => {
2721+ afterEach ( ( ) => {
2722+ sinon . restore ( ) ;
2723+ } ) ;
2724+
2725+ it ( 'sets ._defaultAuth' , ( ) => {
2726+ const auth = 'foo' ;
2727+ api . setDefaultAuth ( auth ) ;
2728+ expect ( api . _defaultAuth ) . to . eql ( auth ) ;
2729+ } ) ;
2730+ } ) ;
27192731} ) ;
You can’t perform that action at this time.
0 commit comments