feat: reapply storage policies to session recording (#2095)
* refactor: 💡 add global settings link ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12257 * fix: 🐛 route ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12257 * fix: 🐛 comment ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12257 * feat: 🎸 add reapply sp to session recording page * fix: 🐛 normalize * feat: 🎸 upates * fix: 🐛 logs * fix: 🐛 comment * test: 💍 add tests * fix: 🐛 normalizer, style * fix: 🐛 normalize * fix: 🐛 normalizw * fix: 🐛 normalize * test: 💍 add tests for serializer n normalizer * fix: 🐛 name * fix: 🐛 do not delete, send null * fix: 🐛 return --------- Co-authored-by: Lisbet Alvarez <lisbet.alvarez@hashicorp.com>
This commit is contained in:
1 parent
9e0467cbf0
commit
fb9a080d2e
19 files changed
+314
-3
No files matched your search
@@ -25,4 +25,45 @@ module('Unit | Serializer | session-recording', function (hooks) {
|
||||
|
||||
assert.ok(serializedRecord);
|
||||
});
|
||||
|
||||
test('it serializes only version when `adapterOptions.method` is `reapply-storage-policy`', function (assert) {
|
||||
const store = this.owner.lookup('service:store');
|
||||
const serializer = store.serializerFor('session-recording');
|
||||
const record = store.createRecord('session-recording', {
|
||||
version: 1,
|
||||
retain_until: 1,
|
||||
delete_after: 2,
|
||||
});
|
||||
const snapshot = record._createSnapshot();
|
||||
snapshot.adapterOptions = {
|
||||
method: 'reapply-storage-policy',
|
||||
};
|
||||
const serializedRecord = serializer.serialize(snapshot);
|
||||
assert.deepEqual(serializedRecord, {});
|
||||
});
|
||||
|
||||
test('it normalizes correctly', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
const serializer = store.serializerFor('session-recording');
|
||||
|
||||
let record = store.createRecord('session-recording').constructor;
|
||||
const payload = {
|
||||
id: '1',
|
||||
type: 'session-recording',
|
||||
errors: 2,
|
||||
};
|
||||
const normalized = serializer.normalize(record, payload);
|
||||
|
||||
assert.deepEqual(normalized, {
|
||||
data: {
|
||||
id: '1',
|
||||
type: 'session-recording',
|
||||
attributes: {
|
||||
errors_number: 2,
|
||||
type: 'session-recording',
|
||||
},
|
||||
relationships: {},
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user