* [COMPLIANCE] Add Copyright and License Headers * chore: 🤖 update Copyright headers to satisfy our lint rules --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Cameron Perera <cameron.perera@hashicorp.com>
32 lines
1020 B
JavaScript
32 lines
1020 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
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' }]);
|
|
});
|
|
});
|