Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tests/integration/model-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,22 @@ module('Integration - Model', function (hooks) {
assert.strictEqual(record.name, 'Jupiter2');
});

test('update cached attribute after rebase', async function (assert) {
const recordBase = cache.addRecord<Planet>({
type: 'planet',
name: 'Jupiter'
});
const fork = cache.fork();
const record = <Planet>fork.findRecord(recordBase.type, recordBase.id);

assert.strictEqual(record.name, 'Jupiter');

recordBase?.$replaceAttribute('name', 'Jupiter2');
fork.rebase();

assert.strictEqual(record.name, 'Jupiter2');
});

test('update via store: replaceAttribute operation invalidates attribute on model', async function (assert) {
const record = await store.addRecord<Planet>({
type: 'planet',
Expand Down