@@ -20,7 +20,8 @@ describe('smartapp-page-spec', () => {
20
20
} )
21
21
} )
22
22
23
- const initResponse = app . handleMockCallback ( {
23
+ // Initialize configuration callback
24
+ app . handleMockCallback ( {
24
25
lifecycle : 'CONFIGURATION' ,
25
26
executionId : 'e6903fe6-f88f-da69-4c12-e2802606ccbc' ,
26
27
locale : 'en' ,
@@ -38,9 +39,19 @@ describe('smartapp-page-spec', () => {
38
39
config : { }
39
40
} ,
40
41
settings : { }
42
+ } ) . then ( initResponse => {
43
+ const expectedInitResponse = { initialize : {
44
+ id : 'xxx' ,
45
+ firstPageId : 'eaMainPage' ,
46
+ permissions : [ ] ,
47
+ disableCustomDisplayName : false ,
48
+ disableRemoveApp : false
49
+ } }
50
+
51
+ assert . deepStrictEqual ( initResponse . configurationData , expectedInitResponse )
41
52
} )
42
53
43
- const pageResponse = app . handleMockCallback ( {
54
+ app . handleMockCallback ( {
44
55
lifecycle : 'CONFIGURATION' ,
45
56
executionId : 'abcf6e72-60f4-1f27-341b-449ad9e2192e' ,
46
57
locale : 'en' ,
@@ -58,68 +69,59 @@ describe('smartapp-page-spec', () => {
58
69
config : { }
59
70
} ,
60
71
settings : { }
61
- } )
62
-
63
- const expectedInitResponse = { initialize : {
64
- id : 'xxx' ,
65
- firstPageId : 'eaMainPage' ,
66
- permissions : [ ] ,
67
- disableCustomDisplayName : false ,
68
- disableRemoveApp : false
69
- } }
70
-
71
- const expectedPageResponse = {
72
- page : {
73
- name : 'pages.eaMainPage.name' ,
74
- complete : true ,
75
- pageId : 'eaMainPage' ,
76
- nextPageId : null ,
77
- previousPageId : null ,
78
- sections : [
79
- {
80
- name : 'whenDoorOpensAndCloses' ,
81
- settings : [
82
- {
83
- id : 'contactSensor' ,
84
- name : 'pages.eaMainPage.settings.contactSensor.name' ,
85
- required : true ,
86
- type : 'DEVICE' ,
87
- description : 'Tap to set' ,
88
- multiple : false ,
89
- capabilities : [
90
- 'contactSensor'
91
- ] ,
92
- permissions : [
93
- 'r'
94
- ]
95
- }
96
- ]
97
- } ,
98
- {
99
- name : 'turnLightsOnAndOff' ,
100
- settings : [
101
- {
102
- id : 'lights' ,
103
- name : 'pages.eaMainPage.settings.lights.name' ,
104
- required : true ,
105
- type : 'DEVICE' ,
106
- description : 'Tap to set' ,
107
- multiple : true ,
108
- capabilities : [
109
- 'switch'
110
- ] ,
111
- permissions : [
112
- 'r' ,
113
- 'x'
114
- ]
115
- }
116
- ]
117
- }
118
- ]
72
+ } ) . then ( pageResponse => {
73
+ const expectedPageResponse = {
74
+ page : {
75
+ name : 'pages.eaMainPage.name' ,
76
+ complete : true ,
77
+ pageId : 'eaMainPage' ,
78
+ nextPageId : null ,
79
+ previousPageId : null ,
80
+ sections : [
81
+ {
82
+ name : 'whenDoorOpensAndCloses' ,
83
+ settings : [
84
+ {
85
+ id : 'contactSensor' ,
86
+ name : 'pages.eaMainPage.settings.contactSensor.name' ,
87
+ required : true ,
88
+ type : 'DEVICE' ,
89
+ description : 'Tap to set' ,
90
+ multiple : false ,
91
+ capabilities : [
92
+ 'contactSensor'
93
+ ] ,
94
+ permissions : [
95
+ 'r'
96
+ ]
97
+ }
98
+ ]
99
+ } ,
100
+ {
101
+ name : 'turnLightsOnAndOff' ,
102
+ settings : [
103
+ {
104
+ id : 'lights' ,
105
+ name : 'pages.eaMainPage.settings.lights.name' ,
106
+ required : true ,
107
+ type : 'DEVICE' ,
108
+ description : 'Tap to set' ,
109
+ multiple : true ,
110
+ capabilities : [
111
+ 'switch'
112
+ ] ,
113
+ permissions : [
114
+ 'r' ,
115
+ 'x'
116
+ ]
117
+ }
118
+ ]
119
+ }
120
+ ]
121
+ }
119
122
}
120
- }
121
- assert . deepStrictEqual ( initResponse . configurationData , expectedInitResponse )
122
- assert . deepStrictEqual ( pageResponse . configurationData , expectedPageResponse )
123
+ assert . deepStrictEqual ( pageResponse . configurationData , expectedPageResponse )
124
+ } )
123
125
} )
124
126
125
127
it ( 'should configure event logger' , ( ) => {
0 commit comments