@@ -128,6 +128,16 @@ describe.each([
128128 { response : 'APP:youtube.leanback.v4' , expected : Apps . youtube } ,
129129 { response : 'APP:com.hbo.hbomax' , expected : Apps . hbomax } ,
130130 { response : 'APP:netflix' , expected : Apps . netflix } ,
131+ {
132+ response :
133+ 'APP:com.webos.app.hdmi1 Hot plug:Connected Signal:Yes HDCP:1.4 HDCP Status:None' ,
134+ expected : 'com.webos.app.hdmi1' ,
135+ } ,
136+ {
137+ response :
138+ 'APP:com.webos.app.hdmi4 Hot plug:Connected Signal:Yes HDCP:2.2 HDCP Status:Authenticated' ,
139+ expected : 'com.webos.app.hdmi4' ,
140+ } ,
131141 { response : 'APP:unsupported' , expected : 'unsupported' } ,
132142 ] ) ( 'gets current app: $response' , async ( { response, expected } ) => {
133143 const mocking = mockResponse ( 'CURRENT_APP' , response ) ;
@@ -137,6 +147,51 @@ describe.each([
137147 await expect ( actual ) . resolves . toBe ( expected ) ;
138148 } ) ;
139149
150+ it . each ( [
151+ { response : '' , expected : null } ,
152+ {
153+ response :
154+ 'APP:com.webos.app.hdmi1 Hot plug:Connected Signal:Yes HDCP:1.4 HDCP Status:None' ,
155+ expected : {
156+ app : 'com.webos.app.hdmi1' ,
157+ hotPlug : 'Connected' ,
158+ signal : true ,
159+ hdcpVersion : '1.4' ,
160+ hdcpStatus : 'None' ,
161+ } ,
162+ } ,
163+ {
164+ response :
165+ 'APP:com.webos.app.hdmi4 Hot plug:Connected Signal:Yes HDCP:2.2 HDCP Status:Authenticated' ,
166+ expected : {
167+ app : 'com.webos.app.hdmi4' ,
168+ hotPlug : 'Connected' ,
169+ signal : true ,
170+ hdcpVersion : '2.2' ,
171+ hdcpStatus : 'Authenticated' ,
172+ } ,
173+ } ,
174+ {
175+ response : 'APP:unsupported' ,
176+ expected : {
177+ app : 'unsupported' ,
178+ hotPlug : undefined ,
179+ signal : undefined ,
180+ hdcpVersion : undefined ,
181+ hdcpStatus : undefined ,
182+ } ,
183+ } ,
184+ ] ) (
185+ 'gets current app details: $response' ,
186+ async ( { response, expected } ) => {
187+ const mocking = mockResponse ( 'CURRENT_APP' , response ) ;
188+ await testTV . connect ( ) ;
189+ const actual = testTV . getCurrentAppDetails ( ) ;
190+ await expect ( mocking ) . resolves . not . toThrow ( ) ;
191+ await expect ( actual ) . resolves . toEqual ( expected ) ;
192+ } ,
193+ ) ;
194+
140195 it . each ( [
141196 { response : 'VOL:0' , expected : 0 } ,
142197 { response : 'VOL:43' , expected : 43 } ,
0 commit comments