Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing test for remoteId on unloaded relationship with data #403

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ef4
Copy link
Contributor

@ef4 ef4 commented Mar 14, 2022

In #400 @dgeb suggested that even unloaded records should have a type, id, and (if configured) remoteId key when accessed via a relationship that loaded with a data property.

These tests demonstrate that that works when the related record is already loaded, but fails when it is not.

In orbitjs#400 @dgeb suggested that even unloaded records should have a type, id, and (if configured) remoteId key when accessed via a relationship that loaded with a `data` property.

These tests demonstrate that that works when the related record is already loaded, but fails when it is not.
},
relationships: {
planet: {
data: t.$normalizeRecordIdentity({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure this correctly simulates what happens in a real app that's using a jsonapi source that gets back a server generated id here, but it does reproduce the same behavior I'm seeing in a real app.

@@ -680,4 +680,71 @@ module('Integration - Model', function (hooks) {
assert.strictEqual(jupiter.name, 'Jupiter');
assert.strictEqual(jupiter.hasName, true);
});

test('hasOne contains type, id, and remoteId for loaded record', async function (assert) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test passes

assert.strictEqual(phobos.planet?.remoteId, '3', 'has expected remoteId');
});

test('hasOne contains type, id, and remoteId for unloaded record', async function (assert) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test fails

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant