File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ AV.init = function init(options, ...params) {
8181 realtime,
8282 } = options ;
8383 if ( AV . applicationId ) throw new Error ( 'SDK is already initialized.' ) ;
84+ if ( ! appId ) throw new TypeError ( 'appId must be a string' ) ;
85+ if ( ! appKey ) throw new TypeError ( 'appKey must be a string' ) ;
8486 if ( process . env . CLIENT_PLATFORM && masterKey ) console . warn ( 'MasterKey is not supposed to be used in browser.' ) ;
8587 AV . _config . applicationId = appId ;
8688 AV . _config . applicationKey = appKey ;
Original file line number Diff line number Diff line change 1+ describe ( 'AV.init' , ( ) => {
2+ before ( function ( ) {
3+ this . originalAppId = AV . applicationId ;
4+ AV . applicationId = undefined ;
5+ } ) ;
6+
7+ after ( function ( ) {
8+ AV . applicationId = this . originalAppId ;
9+ } ) ;
10+
11+ it ( 'param check' , ( ) => {
12+ ( ( ) => AV . init ( ) ) . should . throw ( / m u s t b e a s t r i n g / ) ;
13+ ( ( ) => AV . init ( 'aaa' ) ) . should . throw ( / m u s t b e a s t r i n g / ) ;
14+ ( ( ) => AV . init ( '' , '' ) ) . should . throw ( / m u s t b e a s t r i n g / ) ;
15+ } ) ;
16+ } ) ;
17+
18+
119describe ( 'AV utils' , ( ) => {
220 describe ( '_encode' , ( ) => {
321 it ( 'should be pure' , ( ) => {
You can’t perform that action at this time.
0 commit comments