Refactor host set fragment arrays (#1464)

* refactor: 💡 change host_ids to a simple attribute

* refactor: 💡 manually manage host set array model attributes

* refactor: 💡 Fix host set IDs usage

* style: 💄 Fix comment and add braces for if statements

* refactor: 💡 Add back in empty array for normalizer

* refactor: 💡 Move attributes to generated model

* refactor: 💡 Update array actions when creating new host sets

* test: 💍 Add a few create tests for azure and aws host sets

* test: 💍 Add update tests for azure and aws host sets

Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
This commit is contained in:
Randall MoreyandZhihe Li authored and GitHub committed 2022-11-21 19:07:46 -05:00
1 parent e3d44eb813
commit f7c1523adb
17 files changed
+260 -84

No files matched your search

@@ -15,6 +15,13 @@ module('Unit | Transform | string array', function (hooks) {
]);
});
test('it deserializes null to an empty array', function (assert) {
assert.expect(1);
const transform = this.owner.lookup('transform:string-array');
const deserialized = transform.deserialize(null);
assert.deepEqual(deserialized, []);
});
test('it serializes an array of `{value}` to an array of strings', function (assert) {
assert.expect(1);
const transform = this.owner.lookup('transform:string-array');
@@ -25,4 +32,11 @@ module('Unit | Transform | string array', function (hooks) {
]);
assert.deepEqual(serialized, ['a', 'bee', 'Hello World']);
});
test('it serializes null to an empty array', function (assert) {
assert.expect(1);
const transform = this.owner.lookup('transform:string-array');
const serialized = transform.serialize(null);
assert.deepEqual(serialized, []);
});
});