fix: 🐛 clear token on normalization (#1351)

* fix: 🐛 clear token on normalization
This commit is contained in:
Dharini Jeeva authored and GitHub committed 2022-09-26 18:25:02 -07:00
1 parent 0cba914045
commit 3fc22b4aa3
3 files changed
+86 -42

No files matched your search

@@ -273,4 +273,35 @@ module('Unit | Serializer | credential store', function (hooks) {
};
assert.deepEqual(record.serialize(), expectedResult);
});
test('it normalizes vault type credential store record', async function (assert) {
assert.expect(1);
const store = this.owner.lookup('service:store');
const serializer = store.serializerFor('credential-store');
const credentialStoreModelClass =
store.createRecord('credential-store').constructor;
const payload = {
id: 'csvlt_123',
version: 1,
type: 'vault',
attributes: {
token: 'random',
token_hmac: 'completenonsense',
},
};
const normalized = serializer.normalize(credentialStoreModelClass, payload);
assert.deepEqual(normalized, {
data: {
attributes: {
type: 'vault',
version: 1,
token: '',
token_hmac: 'completenonsense',
},
type: 'credential-store',
id: 'csvlt_123',
relationships: {},
},
});
});
});