Failing test for remoteId on unloaded relationship with data#403
Open
ef4 wants to merge 1 commit intoorbitjs:mainfrom
Open
Failing test for remoteId on unloaded relationship with data#403ef4 wants to merge 1 commit intoorbitjs:mainfrom
ef4 wants to merge 1 commit intoorbitjs:mainfrom
Conversation
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.
ef4
commented
Mar 14, 2022
| }, | ||
| relationships: { | ||
| planet: { | ||
| data: t.$normalizeRecordIdentity({ |
Contributor
Author
There was a problem hiding this comment.
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.
ef4
commented
Mar 14, 2022
| assert.strictEqual(jupiter.hasName, true); | ||
| }); | ||
|
|
||
| test('hasOne contains type, id, and remoteId for loaded record', async function (assert) { |
ef4
commented
Mar 14, 2022
| assert.strictEqual(phobos.planet?.remoteId, '3', 'has expected remoteId'); | ||
| }); | ||
|
|
||
| test('hasOne contains type, id, and remoteId for unloaded record', async function (assert) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
dataproperty.These tests demonstrate that that works when the related record is already loaded, but fails when it is not.