mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 01:21:23 +08:00
FIX: Don't remove the id
from the input to createRecord
This commit is contained in:
@ -19,6 +19,18 @@ test('createRecord without an `id`', function() {
|
||||
ok(!widget.get('id'), 'there is no id');
|
||||
});
|
||||
|
||||
test("createRecord doesn't modify the input `id` field", () => {
|
||||
const store = createStore();
|
||||
const widget = store.createRecord('widget', {id: 1, name: 'hello'});
|
||||
|
||||
const obj = { id: 1, name: 'something' };
|
||||
|
||||
const other = store.createRecord('widget', obj);
|
||||
equal(widget, other, 'returns the same record');
|
||||
equal(widget.name, 'something', 'it updates the properties');
|
||||
equal(obj.id, 1, 'it does not remove the id from the input');
|
||||
});
|
||||
|
||||
test('createRecord without attributes', function() {
|
||||
const store = createStore();
|
||||
const widget = store.createRecord('widget');
|
||||
|
Reference in New Issue
Block a user