mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-11 02:41:12 +01:00
32 lines
850 B
JavaScript
32 lines
850 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { module, test } from 'qunit';
|
|
import { setupTest } from 'ember-qunit';
|
|
|
|
module('Unit | Serializer | kv/data', function (hooks) {
|
|
setupTest(hooks);
|
|
|
|
test('it should always pass the cas option when creating/updating a secret', function (assert) {
|
|
const store = this.owner.lookup('service:store');
|
|
const record = store.createRecord('kv/data', {
|
|
path: 'my-secret-path',
|
|
backend: 'kv-test',
|
|
version: 2,
|
|
casVersion: 3,
|
|
secretData: { foo: 'bar' },
|
|
});
|
|
const expectedResult = {
|
|
data: { foo: 'bar' },
|
|
options: {
|
|
cas: 3,
|
|
},
|
|
};
|
|
|
|
const serializedRecord = record.serialize();
|
|
assert.deepEqual(serializedRecord, expectedResult, 'cas option was correctly added to the payload.');
|
|
});
|
|
});
|