feat: 🎸 implement API for change password
This commit is contained in:
3 files changed
+72
No files matched your search
@@ -94,4 +94,32 @@ module('Unit | Serializer | account', function (hooks) {
|
||||
version: 1,
|
||||
});
|
||||
});
|
||||
|
||||
test('it serializes a custom payload when `adapterOptions.method` is set to `change-password`', function (assert) {
|
||||
assert.expect(1);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const serializer = store.serializerFor('account');
|
||||
const record = store.createRecord('account', {
|
||||
type: 'password',
|
||||
name: 'Name',
|
||||
description: 'Description',
|
||||
attributes: {
|
||||
login_name: 'Login Name',
|
||||
},
|
||||
auth_method_id: '1',
|
||||
version: 1,
|
||||
});
|
||||
const snapshot = record._createSnapshot();
|
||||
snapshot.adapterOptions = {
|
||||
method: 'change-password',
|
||||
currentPassword: 'Current',
|
||||
newPassword: 'New',
|
||||
};
|
||||
const serializedRecord = serializer.serialize(snapshot);
|
||||
assert.deepEqual(serializedRecord, {
|
||||
current_password: 'Current',
|
||||
new_password: 'New',
|
||||
version: 1,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user