@codifycli/plugin-core 1.2.1-beta.1 → 1.2.1
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/package.json +1 -1
- package/src/plan/change-set.test.ts +27 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codifycli/plugin-core",
|
|
3
|
-
"version": "1.2.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "TypeScript library for building Codify plugins to manage system resources (applications, CLI tools, settings) through infrastructure-as-code",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -304,6 +304,33 @@ describe('Change set tests', () => {
|
|
|
304
304
|
expect(cs.operation).to.eq(ResourceOperation.DESTROY);
|
|
305
305
|
})
|
|
306
306
|
|
|
307
|
+
it('treats empty objects {} as no-op', () => {
|
|
308
|
+
const desired = {
|
|
309
|
+
keyboard: {},
|
|
310
|
+
dock: {},
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const current = {
|
|
314
|
+
keyboard: {},
|
|
315
|
+
dock: {},
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const cs = ChangeSet.calculateModification(desired, current);
|
|
319
|
+
expect(cs.parameterChanges.length).to.eq(0);
|
|
320
|
+
expect(cs.operation).to.eq(ResourceOperation.NOOP);
|
|
321
|
+
})
|
|
322
|
+
|
|
323
|
+
it('treats empty object {} as absent when current has no value', () => {
|
|
324
|
+
const desired = {
|
|
325
|
+
keyboard: {},
|
|
326
|
+
dock: {},
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const cs = ChangeSet.calculateModification(desired, {});
|
|
330
|
+
expect(cs.parameterChanges.length).to.eq(0);
|
|
331
|
+
expect(cs.operation).to.eq(ResourceOperation.NOOP);
|
|
332
|
+
})
|
|
333
|
+
|
|
307
334
|
it('correctly determines array equality 5', () => {
|
|
308
335
|
const arrA = [{ key1: 'b' }, { key1: 'a' }, { key1: 'a' }];
|
|
309
336
|
const arrB = [{ key1: 'a' }, { key1: 'a' }, { key1: 'b' }];
|