* refactor: 💡 convert brokered cred IDs array to simple attribute * fix: 🐛 missing test assertion * fix: 🐛 simplify computed * refactor: 💡 convert host sources array to simple attribute (#1260) * refactor: 💡 convert host source IDs array to simple attribute * fix: 🐛 host source tests * Refactor role fragment arrays (#1262) * refactor: 💡 convert grant strings to regular attribute * refactor: 💡 convert principals array to simple attribute * Update ui/admin/app/routes/scopes/scope/roles/role.js Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> * fix: 🐛 remove unused import Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
27 lines
942 B
JavaScript
27 lines
942 B
JavaScript
import { module, test } from 'qunit';
|
|
import { setupTest } from 'ember-qunit';
|
|
|
|
module('Unit | Transform | host source id array', function (hooks) {
|
|
setupTest(hooks);
|
|
|
|
test('it deserializes an array of strings to an array of `{value}`', function (assert) {
|
|
assert.expect(1);
|
|
const transform = this.owner.lookup('transform:host-source-id-array');
|
|
const deserialized = transform.deserialize([
|
|
{ id: '123', host_catalog_id: '1' },
|
|
]);
|
|
assert.deepEqual(deserialized, [
|
|
{ host_source_id: '123', host_catalog_id: '1' },
|
|
]);
|
|
});
|
|
|
|
test('it serializes an array of `{value}` to an array of strings', function (assert) {
|
|
assert.expect(1);
|
|
const transform = this.owner.lookup('transform:host-source-id-array');
|
|
const serialized = transform.serialize([
|
|
{ host_source_id: '123', host_catalog_id: '1' },
|
|
]);
|
|
assert.deepEqual(serialized, [{ id: '123', host_catalog_id: '1' }]);
|
|
});
|
|
});
|