File tree Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -234,13 +234,18 @@ function buildSdk() {
234234}
235235
236236function logName ( Arn ) {
237- const [ logGroupName , logStreamName ] = Arn . split ( ":log-group:" )
238- . pop ( )
239- . split ( ":log-stream:" ) ;
240- if ( logGroupName === "null" || logStreamName === "null" )
241- return {
242- logGroupName : undefined ,
243- logStreamName : undefined ,
244- } ;
245- return { logGroupName, logStreamName } ;
237+ const logs = {
238+ logGroupName : undefined ,
239+ logStreamName : undefined ,
240+ } ;
241+ if ( Arn ) {
242+ const [ logGroupName , logStreamName ] = Arn . split ( ":log-group:" )
243+ . pop ( )
244+ . split ( ":log-stream:" ) ;
245+ if ( logGroupName !== "null" && logStreamName !== "null" ) {
246+ logs . logGroupName = logGroupName ;
247+ logs . logStreamName = logStreamName ;
248+ }
249+ }
250+ return logs ;
246251}
Original file line number Diff line number Diff line change @@ -29,6 +29,13 @@ describe("logName", () => {
2929 expect ( test ) . to . haveOwnProperty ( "logGroupName" ) . and . to . equal ( undefined ) ;
3030 expect ( test ) . to . haveOwnProperty ( "logStreamName" ) . and . to . equal ( undefined ) ;
3131 } ) ;
32+
33+ it ( "return undefined when the Arn is undefined" , ( ) => {
34+ const arn = undefined ;
35+ const test = logName ( arn ) ;
36+ expect ( test ) . to . haveOwnProperty ( "logGroupName" ) . and . to . equal ( undefined ) ;
37+ expect ( test ) . to . haveOwnProperty ( "logStreamName" ) . and . to . equal ( undefined ) ;
38+ } ) ;
3239} ) ;
3340
3441describe ( "githubInputs" , ( ) => {
You can’t perform that action at this time.
0 commit comments