6
6
'use strict'
7
7
8
8
import assert from 'assert'
9
- import {
10
- activationLaunchPathKey ,
11
- ActivationReloadState ,
12
- samInitRuntimeKey ,
13
- samInitImageBooleanKey ,
14
- activationTemplatePathKey ,
15
- } from '../../shared/activationReloadState'
9
+ import { ActivationReloadState } from '../../shared/activationReloadState'
16
10
import globals , { checkDidReload } from '../../shared/extensionGlobals'
17
11
18
12
describe ( 'ActivationReloadState' , async function ( ) {
@@ -27,10 +21,10 @@ describe('ActivationReloadState', async function () {
27
21
} )
28
22
29
23
it ( 'decides globals.didReload' , async function ( ) {
30
- await globals . context . globalState . update ( activationLaunchPathKey , undefined )
24
+ await globals . globalState . update ( 'ACTIVATION_LAUNCH_PATH_KEY' , undefined )
31
25
assert . strictEqual ( checkDidReload ( globals . context ) , false )
32
26
33
- await globals . context . globalState . update ( activationLaunchPathKey , '/some/path' )
27
+ await globals . globalState . update ( 'ACTIVATION_LAUNCH_PATH_KEY' , '/some/path' )
34
28
assert . strictEqual ( checkDidReload ( globals . context ) , true )
35
29
} )
36
30
@@ -45,22 +39,22 @@ describe('ActivationReloadState', async function () {
45
39
} )
46
40
47
41
assert . strictEqual (
48
- globals . context . globalState . get ( activationLaunchPathKey ) ,
42
+ globals . globalState . get ( 'ACTIVATION_LAUNCH_PATH_KEY' ) ,
49
43
'somepath' ,
50
44
'Unexpected Launch Path value was set'
51
45
)
52
46
assert . strictEqual (
53
- globals . context . globalState . get ( activationTemplatePathKey ) ,
47
+ globals . globalState . get ( 'ACTIVATION_TEMPLATE_PATH_KEY' ) ,
54
48
'sometemplate' ,
55
49
'Unexpected Template Path value was set'
56
50
)
57
51
assert . strictEqual (
58
- globals . context . globalState . get ( samInitRuntimeKey ) ,
52
+ globals . globalState . get ( 'SAM_INIT_RUNTIME_KEY' ) ,
59
53
undefined ,
60
54
'Unexpected init runtime key value was set'
61
55
)
62
56
assert . strictEqual (
63
- globals . context . globalState . get ( samInitImageBooleanKey ) ,
57
+ globals . globalState . get ( 'SAM_INIT_IMAGE_BOOLEAN_KEY' ) ,
64
58
false ,
65
59
'Unexpected init image boolean value was set'
66
60
)
@@ -76,22 +70,22 @@ describe('ActivationReloadState', async function () {
76
70
} )
77
71
78
72
assert . strictEqual (
79
- globals . context . globalState . get ( activationLaunchPathKey ) ,
73
+ globals . globalState . get ( 'ACTIVATION_LAUNCH_PATH_KEY' ) ,
80
74
'somepath' ,
81
75
'Unexpected Launch Path value was set'
82
76
)
83
77
assert . strictEqual (
84
- globals . context . globalState . get ( activationTemplatePathKey ) ,
78
+ globals . globalState . get ( 'ACTIVATION_TEMPLATE_PATH_KEY' ) ,
85
79
'sometemplate' ,
86
80
'Unexpected Template Path value was set'
87
81
)
88
82
assert . strictEqual (
89
- globals . context . globalState . get ( samInitRuntimeKey ) ,
83
+ globals . globalState . get ( 'SAM_INIT_RUNTIME_KEY' ) ,
90
84
'someruntime' ,
91
85
'Unexpected init runtime value was set'
92
86
)
93
87
assert . strictEqual (
94
- globals . context . globalState . get ( samInitImageBooleanKey ) ,
88
+ globals . globalState . get ( 'SAM_INIT_IMAGE_BOOLEAN_KEY' ) ,
95
89
false ,
96
90
'Unexpected init image boolean value was set'
97
91
)
@@ -107,22 +101,22 @@ describe('ActivationReloadState', async function () {
107
101
} )
108
102
109
103
assert . strictEqual (
110
- globals . context . globalState . get ( activationLaunchPathKey ) ,
104
+ globals . globalState . get ( 'ACTIVATION_LAUNCH_PATH_KEY' ) ,
111
105
'somepath' ,
112
106
'Unexpected Launch Path value was set'
113
107
)
114
108
assert . strictEqual (
115
- globals . context . globalState . get ( activationTemplatePathKey ) ,
109
+ globals . globalState . get ( 'ACTIVATION_TEMPLATE_PATH_KEY' ) ,
116
110
'sometemplate' ,
117
111
'Unexpected Template Path value was set'
118
112
)
119
113
assert . strictEqual (
120
- globals . context . globalState . get ( samInitRuntimeKey ) ,
114
+ globals . globalState . get ( 'SAM_INIT_RUNTIME_KEY' ) ,
121
115
'someruntime' ,
122
116
'Unexpected init runtime value was set'
123
117
)
124
118
assert . strictEqual (
125
- globals . context . globalState . get ( samInitImageBooleanKey ) ,
119
+ globals . globalState . get ( 'SAM_INIT_IMAGE_BOOLEAN_KEY' ) ,
126
120
true ,
127
121
'Unexpected init image boolean value was set'
128
122
)
@@ -131,9 +125,9 @@ describe('ActivationReloadState', async function () {
131
125
132
126
describe ( 'getSamInitState' , async function ( ) {
133
127
it ( 'path defined, without runtime' , async function ( ) {
134
- await globals . context . globalState . update ( activationLaunchPathKey , 'getsomepath' )
135
- await globals . context . globalState . update ( activationTemplatePathKey , 'gettemplatepath' )
136
- await globals . context . globalState . update ( samInitRuntimeKey , undefined )
128
+ await globals . globalState . update ( 'ACTIVATION_LAUNCH_PATH_KEY' , 'getsomepath' )
129
+ await globals . globalState . update ( 'ACTIVATION_TEMPLATE_PATH_KEY' , 'gettemplatepath' )
130
+ await globals . globalState . update ( 'SAM_INIT_RUNTIME_KEY' , undefined )
137
131
138
132
assert . strictEqual (
139
133
activationReloadState . getSamInitState ( ) ?. readme ,
@@ -158,9 +152,9 @@ describe('ActivationReloadState', async function () {
158
152
} )
159
153
160
154
it ( 'path defined, with runtime' , async function ( ) {
161
- await globals . context . globalState . update ( activationLaunchPathKey , 'getsomepath' )
162
- await globals . context . globalState . update ( activationTemplatePathKey , 'gettemplatepath' )
163
- await globals . context . globalState . update ( samInitRuntimeKey , 'getsomeruntime' )
155
+ await globals . globalState . update ( 'ACTIVATION_LAUNCH_PATH_KEY' , 'getsomepath' )
156
+ await globals . globalState . update ( 'ACTIVATION_TEMPLATE_PATH_KEY' , 'gettemplatepath' )
157
+ await globals . globalState . update ( 'SAM_INIT_RUNTIME_KEY' , 'getsomeruntime' )
164
158
165
159
assert . strictEqual (
166
160
activationReloadState . getSamInitState ( ) ?. readme ,
@@ -185,10 +179,10 @@ describe('ActivationReloadState', async function () {
185
179
} )
186
180
187
181
it ( 'path defined, with runtime and isImage' , async function ( ) {
188
- await globals . context . globalState . update ( activationLaunchPathKey , 'getsomepath' )
189
- await globals . context . globalState . update ( activationTemplatePathKey , 'gettemplatepath' )
190
- await globals . context . globalState . update ( samInitRuntimeKey , 'getsomeruntime' )
191
- await globals . context . globalState . update ( samInitImageBooleanKey , true )
182
+ await globals . globalState . update ( 'ACTIVATION_LAUNCH_PATH_KEY' , 'getsomepath' )
183
+ await globals . globalState . update ( 'ACTIVATION_TEMPLATE_PATH_KEY' , 'gettemplatepath' )
184
+ await globals . globalState . update ( 'SAM_INIT_RUNTIME_KEY' , 'getsomeruntime' )
185
+ await globals . globalState . update ( 'SAM_INIT_IMAGE_BOOLEAN_KEY' , true )
192
186
193
187
assert . strictEqual (
194
188
activationReloadState . getSamInitState ( ) ?. readme ,
@@ -224,25 +218,25 @@ describe('ActivationReloadState', async function () {
224
218
activationReloadState . clearSamInitState ( )
225
219
226
220
assert . strictEqual (
227
- globals . context . globalState . get ( activationLaunchPathKey ) ,
221
+ globals . globalState . get ( 'ACTIVATION_LAUNCH_PATH_KEY' ) ,
228
222
undefined ,
229
223
'Expected launch path to be cleared (undefined)'
230
224
)
231
225
232
226
assert . strictEqual (
233
- globals . context . globalState . get ( activationTemplatePathKey ) ,
227
+ globals . globalState . get ( 'ACTIVATION_TEMPLATE_PATH_KEY' ) ,
234
228
undefined ,
235
229
'Expected template path to be cleared (undefined)'
236
230
)
237
231
238
232
assert . strictEqual (
239
- globals . context . globalState . get ( samInitRuntimeKey ) ,
233
+ globals . globalState . get ( 'SAM_INIT_RUNTIME_KEY' ) ,
240
234
undefined ,
241
235
'Expected runtime key to be cleared (undefined)'
242
236
)
243
237
244
238
assert . strictEqual (
245
- globals . context . globalState . get ( samInitImageBooleanKey ) ,
239
+ globals . globalState . get ( 'SAM_INIT_IMAGE_BOOLEAN_KEY' ) ,
246
240
undefined ,
247
241
'Expected isImage key to be cleared (undefined)'
248
242
)
0 commit comments