-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Bugfix: coalesceFindRequests should work with non native Adapter classes #7448
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7779287
Bugfix: coalesceFindRequests should work with non native Adapter classes
snewcomer db3202c
add a test
snewcomer fa67835
Add unit tests for rest and json-api
snewcomer f4f5382
revert integration test
snewcomer 7a942c5
put next to docs
snewcomer d0b5565
lint fix
snewcomer 90b02d8
default to launching with no container
runspired File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
39 changes: 39 additions & 0 deletions
39
packages/-ember-data/tests/unit/adapters/json-api-adapter/json-api-test.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { module, test } from 'qunit'; | ||
|
||
import JSONAPIAdapter from '@ember-data/adapter/json-api'; | ||
|
||
module('unit/adapters/json-api-test', function() { | ||
test('coalesceFindRequests default', function(assert) { | ||
const adapter = JSONAPIAdapter.extend(); | ||
assert.deepEqual(adapter.create().coalesceFindRequests, false, 'default result is false'); | ||
}); | ||
|
||
test('coalesceFindRequests true', function(assert) { | ||
const adapter = JSONAPIAdapter.extend({ coalesceFindRequests: true }); | ||
assert.deepEqual(adapter.create().coalesceFindRequests, true, 'result is true'); | ||
}); | ||
|
||
test('coalesceFindRequests false', function(assert) { | ||
const adapter = JSONAPIAdapter.extend({ coalesceFindRequests: false }); | ||
assert.deepEqual(adapter.create().coalesceFindRequests, false, 'result is false'); | ||
}); | ||
|
||
test('coalesceFindRequests class default', function(assert) { | ||
class MyClass extends JSONAPIAdapter {} | ||
assert.deepEqual(MyClass.create().coalesceFindRequests, false, 'default result is false'); | ||
}); | ||
|
||
test('coalesceFindRequests class true', function(assert) { | ||
class MyClass extends JSONAPIAdapter { | ||
coalesceFindRequests = true; | ||
} | ||
assert.deepEqual(MyClass.create().coalesceFindRequests, true, 'result is true'); | ||
}); | ||
|
||
test('coalesceFindRequests class false', function(assert) { | ||
class MyClass extends JSONAPIAdapter { | ||
coalesceFindRequests = false; | ||
} | ||
assert.deepEqual(MyClass.create().coalesceFindRequests, false, 'result is false'); | ||
}); | ||
}); |
39 changes: 39 additions & 0 deletions
39
packages/-ember-data/tests/unit/adapters/rest-adapter/rest-test.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { module, test } from 'qunit'; | ||
|
||
import RESTAdapter from '@ember-data/adapter/rest'; | ||
|
||
module('unit/adapters/rest-test', function() { | ||
test('coalesceFindRequests default', function(assert) { | ||
const adapter = RESTAdapter.extend(); | ||
assert.deepEqual(adapter.create().coalesceFindRequests, false, 'default result is false'); | ||
}); | ||
|
||
test('coalesceFindRequests true', function(assert) { | ||
const adapter = RESTAdapter.extend({ coalesceFindRequests: true }); | ||
assert.deepEqual(adapter.create().coalesceFindRequests, true, 'result is true'); | ||
}); | ||
|
||
test('coalesceFindRequests false', function(assert) { | ||
const adapter = RESTAdapter.extend({ coalesceFindRequests: false }); | ||
assert.deepEqual(adapter.create().coalesceFindRequests, false, 'result is false'); | ||
}); | ||
|
||
test('coalesceFindRequests class default', function(assert) { | ||
class MyClass extends RESTAdapter {} | ||
assert.deepEqual(MyClass.create().coalesceFindRequests, false, 'default result is false'); | ||
}); | ||
|
||
test('coalesceFindRequests class true', function(assert) { | ||
class MyClass extends RESTAdapter { | ||
coalesceFindRequests = true; | ||
} | ||
assert.deepEqual(MyClass.create().coalesceFindRequests, true, 'result is true'); | ||
}); | ||
|
||
test('coalesceFindRequests class false', function(assert) { | ||
class MyClass extends RESTAdapter { | ||
coalesceFindRequests = false; | ||
} | ||
assert.deepEqual(MyClass.create().coalesceFindRequests, false, 'result is false'); | ||
}); | ||
}); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WAT. I missed this discussion and I am sad. tc39/proposal-class-fields#151 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a better alternative here may be to do this within the constructor.