homey-lib 2.45.0 → 2.45.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/capability/capabilities/cooking_time.json +1 -0
- package/assets/capability/capabilities/target_power.json +20 -20
- package/assets/capability/capabilities/target_power_mode.json +47 -47
- package/lib/App/index.js +1 -1
- package/package.json +1 -1
- package/webpack/index.js +1 -1
- package/.github/workflows/apply_locales.yml +0 -57
- package/.github/workflows/deploy.yml +0 -181
- package/.github/workflows/generate_locales.yml +0 -60
- package/.github/workflows/static.yml +0 -43
- package/.github/workflows/test.yml +0 -51
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/node-homey-lib.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/test/fixtures/mock-app.js +0 -137
- package/test/validate-base-manifest.js +0 -685
- package/test/validate-capabilities.js +0 -109
- package/test/validate-driver-manifest.js +0 -835
- package/test/validate-files.js +0 -267
package/test/validate-files.js
DELETED
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
/* eslint-disable node/no-unpublished-require */
|
|
2
|
-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
mockApp,
|
|
7
|
-
clearMockApp,
|
|
8
|
-
assertValidates,
|
|
9
|
-
createFakePng,
|
|
10
|
-
baseAppManifest,
|
|
11
|
-
baseDriverManifest,
|
|
12
|
-
} = require('./fixtures/mock-app');
|
|
13
|
-
|
|
14
|
-
const HomeyLib = require('..');
|
|
15
|
-
|
|
16
|
-
describe('HomeyLib.App#validate() files', function() {
|
|
17
|
-
this.slow(500);
|
|
18
|
-
|
|
19
|
-
afterEach(function() {
|
|
20
|
-
clearMockApp();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('can validate a minimal app manifest for debug', async function() {
|
|
24
|
-
const app = mockApp({
|
|
25
|
-
id: 'test.app',
|
|
26
|
-
name: { en: 'Test' },
|
|
27
|
-
version: '1.0.0',
|
|
28
|
-
sdk: 3,
|
|
29
|
-
compatibility: '>=5.0.0',
|
|
30
|
-
author: {
|
|
31
|
-
name: 'Athom B.V.',
|
|
32
|
-
email: 'info@athom.com',
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
await assertValidates(app, {
|
|
37
|
-
debug: true,
|
|
38
|
-
publish: /property `category` is required/i,
|
|
39
|
-
verified: /property `platforms` is required/i,
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('can validate a minimal app manifest for publish', async function() {
|
|
44
|
-
const app = mockApp({
|
|
45
|
-
id: 'test.app',
|
|
46
|
-
name: { en: 'Test' },
|
|
47
|
-
// description: { en: 'Test app' }, // TODO: should this be required?
|
|
48
|
-
brandColor: '#000000',
|
|
49
|
-
version: '1.0.0',
|
|
50
|
-
sdk: 3,
|
|
51
|
-
compatibility: '>=5.0.0',
|
|
52
|
-
category: ['tools'],
|
|
53
|
-
images: {
|
|
54
|
-
small: '/assets/images/small.png',
|
|
55
|
-
large: '/assets/images/large.png',
|
|
56
|
-
xlarge: '/assets/images/xlarge.png',
|
|
57
|
-
},
|
|
58
|
-
author: {
|
|
59
|
-
name: 'Athom B.V.',
|
|
60
|
-
email: 'info@athom.com',
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
await assertValidates(app, {
|
|
65
|
-
debug: true,
|
|
66
|
-
publish: true,
|
|
67
|
-
verified: /property `platforms` is required/i,
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('can validate a minimal app manifest for verified', async function() {
|
|
72
|
-
const app = mockApp({
|
|
73
|
-
id: 'test.app',
|
|
74
|
-
name: { en: 'Test' },
|
|
75
|
-
// description: { en: 'Test app' }, // TODO: should this be required?
|
|
76
|
-
brandColor: '#000000',
|
|
77
|
-
version: '1.0.0',
|
|
78
|
-
sdk: 3,
|
|
79
|
-
compatibility: '>=5.0.0',
|
|
80
|
-
platforms: ['local', 'cloud'],
|
|
81
|
-
category: ['tools'],
|
|
82
|
-
images: {
|
|
83
|
-
small: '/assets/images/small.png',
|
|
84
|
-
large: '/assets/images/large.png',
|
|
85
|
-
xlarge: '/assets/images/xlarge.png',
|
|
86
|
-
},
|
|
87
|
-
author: {
|
|
88
|
-
name: 'Athom B.V.',
|
|
89
|
-
email: 'info@athom.com',
|
|
90
|
-
},
|
|
91
|
-
support: 'mailto:support@homey.app',
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
await assertValidates(app, {
|
|
95
|
-
debug: true,
|
|
96
|
-
publish: true,
|
|
97
|
-
verified: true,
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
/*
|
|
102
|
-
* App Icon
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
|
-
it('assets/icon.svg needs to exist', async function() {
|
|
106
|
-
const app = mockApp(baseAppManifest, {
|
|
107
|
-
files: {
|
|
108
|
-
'assets.icon\\.svg': undefined,
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
await assertValidates(app, {
|
|
113
|
-
debug: /filepath does not exist/i,
|
|
114
|
-
publish: /filepath does not exist/i,
|
|
115
|
-
verified: /filepath does not exist/i,
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
/*
|
|
120
|
-
* App Images
|
|
121
|
-
*/
|
|
122
|
-
|
|
123
|
-
it('/assets/images/*.png should be valid images', async function() {
|
|
124
|
-
const app = mockApp({
|
|
125
|
-
...baseAppManifest,
|
|
126
|
-
images: {
|
|
127
|
-
small: '/assets/images/small.png',
|
|
128
|
-
large: '/assets/images/large.png',
|
|
129
|
-
xlarge: '/assets/images/xlarge.png',
|
|
130
|
-
},
|
|
131
|
-
}, {
|
|
132
|
-
files: {
|
|
133
|
-
'assets.images.small\\.png': undefined,
|
|
134
|
-
'assets.images.large\\.png': undefined,
|
|
135
|
-
'assets.images.xlarge\\.png': undefined,
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
await assertValidates(app, {
|
|
140
|
-
debug: true, // debug does not validate images
|
|
141
|
-
publish: /filepath does not exist/i,
|
|
142
|
-
verified: /filepath does not exist/i,
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it('/assets/images/*.png should have the correct size', async function() {
|
|
147
|
-
const app = mockApp({
|
|
148
|
-
...baseAppManifest,
|
|
149
|
-
images: {
|
|
150
|
-
small: '/assets/images/small.png',
|
|
151
|
-
large: '/assets/images/large.png',
|
|
152
|
-
xlarge: '/assets/images/xlarge.png',
|
|
153
|
-
},
|
|
154
|
-
}, {
|
|
155
|
-
files: {
|
|
156
|
-
'assets.images.small\\.png': createFakePng({ width: 0, height: 0 }),
|
|
157
|
-
'assets.images.large\\.png': createFakePng({ width: 0, height: 0 }),
|
|
158
|
-
'assets.images.xlarge\\.png': createFakePng({ width: 0, height: 0 }),
|
|
159
|
-
},
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
await assertValidates(app, {
|
|
163
|
-
debug: true, // debug does not validate images
|
|
164
|
-
publish: /invalid image size/i,
|
|
165
|
-
verified: /invalid image size/i,
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
/*
|
|
170
|
-
* Driver Images
|
|
171
|
-
*/
|
|
172
|
-
|
|
173
|
-
it('drivers/test/assets/images/*.png should be valid images', async function() {
|
|
174
|
-
const app = mockApp({
|
|
175
|
-
...baseAppManifest,
|
|
176
|
-
drivers: [{
|
|
177
|
-
...baseDriverManifest,
|
|
178
|
-
images: {
|
|
179
|
-
small: 'drivers/test/assets/images/small.png',
|
|
180
|
-
large: 'drivers/test/assets/images/large.png',
|
|
181
|
-
xlarge: 'drivers/test/assets/images/xlarge.png',
|
|
182
|
-
},
|
|
183
|
-
}],
|
|
184
|
-
}, {
|
|
185
|
-
files: {
|
|
186
|
-
'drivers.test.assets.images.small\\.png': undefined,
|
|
187
|
-
'drivers.test.assets.images.large\\.png': undefined,
|
|
188
|
-
'drivers.test.assets.images.xlarge\\.png': undefined,
|
|
189
|
-
},
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
await assertValidates(app, {
|
|
193
|
-
debug: true, // debug does not validate images
|
|
194
|
-
publish: /filepath does not exist/i,
|
|
195
|
-
verified: /filepath does not exist/i,
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
it('drivers/test/assets/images/*.png should have the correct size', async function() {
|
|
200
|
-
const app = mockApp({
|
|
201
|
-
...baseAppManifest,
|
|
202
|
-
drivers: [{
|
|
203
|
-
...baseDriverManifest,
|
|
204
|
-
images: {
|
|
205
|
-
small: 'drivers/test/assets/images/small.png',
|
|
206
|
-
large: 'drivers/test/assets/images/large.png',
|
|
207
|
-
xlarge: 'drivers/test/assets/images/xlarge.png',
|
|
208
|
-
},
|
|
209
|
-
}],
|
|
210
|
-
}, {
|
|
211
|
-
files: {
|
|
212
|
-
'drivers.test.assets.images.small\\.png': createFakePng({ width: 0, height: 0 }),
|
|
213
|
-
'drivers.test.assets.images.large\\.png': createFakePng({ width: 0, height: 0 }),
|
|
214
|
-
'drivers.test.assets.images.xlarge\\.png': createFakePng({ width: 0, height: 0 }),
|
|
215
|
-
},
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
await assertValidates(app, {
|
|
219
|
-
debug: true, // debug does not validate images
|
|
220
|
-
publish: /invalid image size/i,
|
|
221
|
-
verified: /invalid image size/i,
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
/*
|
|
226
|
-
* App Env
|
|
227
|
-
*/
|
|
228
|
-
|
|
229
|
-
it('/env.json can only contain uppercase properties', async function() {
|
|
230
|
-
const app = mockApp(baseAppManifest, {
|
|
231
|
-
env: { test: 'abc' },
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
await assertValidates(app, {
|
|
235
|
-
debug: /invalid \/env\.json key/i,
|
|
236
|
-
publish: /invalid \/env\.json key/i,
|
|
237
|
-
verified: /invalid \/env\.json key/i,
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
it('env.json can only contain string values', async function() {
|
|
242
|
-
const app = mockApp(baseAppManifest, {
|
|
243
|
-
env: { TEST: 1 },
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
await assertValidates(app, {
|
|
247
|
-
debug: /invalid \/env\.json value/i,
|
|
248
|
-
publish: /invalid \/env\.json value/i,
|
|
249
|
-
verified: /invalid \/env\.json value/i,
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
/*
|
|
254
|
-
* Test Test Cleanup
|
|
255
|
-
*/
|
|
256
|
-
|
|
257
|
-
it('fails when an app does not exist', async function() {
|
|
258
|
-
// This tests that the mock is reset correctly (that makes sure our other tests are reliable)
|
|
259
|
-
const app = new HomeyLib.App('test_app');
|
|
260
|
-
|
|
261
|
-
await assertValidates(app, {
|
|
262
|
-
debug: /no such file or directory/i,
|
|
263
|
-
publish: /no such file or directory/i,
|
|
264
|
-
verified: /no such file or directory/i,
|
|
265
|
-
});
|
|
266
|
-
});
|
|
267
|
-
});
|