File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,8 @@ function isString(value) {
104
104
function pnotice ( namespace , options = { } ) {
105
105
return ( text , level = 'INFO' , optionsInner = { } ) => {
106
106
if ( ! isString ( level ) ) {
107
- optionsInner = level
107
+ optionsInner = { ...level }
108
+ level = undefined
108
109
}
109
110
110
111
if ( optionsInner . level ) {
Original file line number Diff line number Diff line change @@ -96,14 +96,25 @@ if (config.chat.id) {
96
96
t . is ( response ?. status , 'ok' )
97
97
} )
98
98
99
+ test ( 'handle no level but optionsInner (with level) as second argument' , async ( t ) => {
100
+ const pn = pnotice ( 'pntest' , {
101
+ disabled : false ,
102
+ debug : true ,
103
+ chat : config . chat ,
104
+ env : 'test' ,
105
+ } )
106
+ const response = await pn ( 'handle no level but optionsInner (with level) as second argument' , { level : 'TESTING' , silent : true } )
107
+ t . is ( response ?. status , 'ok' )
108
+ } )
109
+
99
110
test ( 'handle no level but optionsInner as second argument' , async ( t ) => {
100
111
const pn = pnotice ( 'pntest' , {
101
112
disabled : false ,
102
113
debug : true ,
103
114
chat : config . chat ,
104
115
env : 'test' ,
105
116
} )
106
- const response = await pn ( 'handle no level but optionsInner as second argument' , { level : 'TESTING' , silent : true } )
117
+ const response = await pn ( 'handle no level but optionsInner as second argument' , { silent : true } )
107
118
t . is ( response ?. status , 'ok' )
108
119
} )
109
120
You can’t perform that action at this time.
0 commit comments