2023-03-01 09:39:41 -06:00
|
|
|
/**
|
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2022-12-02 14:29:53 -05:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
|
import { setupTest } from 'ember-qunit';
|
|
|
|
|
|
2023-07-13 09:19:38 -04:00
|
|
|
module('Unit | Transform | account value map array', function (hooks) {
|
2022-12-02 14:29:53 -05:00
|
|
|
setupTest(hooks);
|
|
|
|
|
|
|
|
|
|
test('it deserializes an array of account claims', function (assert) {
|
2023-07-13 09:19:38 -04:00
|
|
|
const transform = this.owner.lookup('transform:account-value-map-array');
|
2022-12-02 14:29:53 -05:00
|
|
|
const deserialized = transform.deserialize(['oid=sub', 'full_name=name']);
|
|
|
|
|
assert.deepEqual(deserialized, [
|
|
|
|
|
{ from: 'oid', to: 'sub' },
|
|
|
|
|
{ from: 'full_name', to: 'name' },
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('it serializes an array of account claims', function (assert) {
|
2023-07-13 09:19:38 -04:00
|
|
|
const transform = this.owner.lookup('transform:account-value-map-array');
|
2022-12-02 14:29:53 -05:00
|
|
|
const serialized = transform.serialize([
|
|
|
|
|
{ from: 'oid', to: 'sub' },
|
|
|
|
|
{ from: 'full_name', to: 'name' },
|
|
|
|
|
]);
|
|
|
|
|
assert.deepEqual(serialized, ['oid=sub', 'full_name=name']);
|
|
|
|
|
});
|
|
|
|
|
});
|