-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4178 from courajs/store-type-presence-checks
DS.Store type presence checks
- Loading branch information
Showing
4 changed files
with
56 additions
and
6 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import {module} from 'qunit'; | ||
import testInDebug from 'dummy/tests/helpers/test-in-debug'; | ||
import {createStore} from 'dummy/tests/helpers/store'; | ||
|
||
module("unit/store/asserts - DS.Store methods produce useful assertion messages"); | ||
|
||
const MODEL_NAME_METHODS = [ | ||
'createRecord', | ||
'findRecord', | ||
'findByIds', | ||
'peekRecord', | ||
'hasRecordForId', | ||
'recordForId', | ||
'query', | ||
'queryRecord', | ||
'findAll', | ||
'peekAll', | ||
'filter', | ||
'recordIsLoaded', | ||
'modelFor', | ||
'modelFactoryFor', | ||
'normalize', | ||
'adapterFor', | ||
'serializerFor' | ||
]; | ||
|
||
testInDebug("Calling Store methods with no type asserts", function(assert) { | ||
assert.expect(MODEL_NAME_METHODS.length); | ||
let store = createStore(); | ||
|
||
MODEL_NAME_METHODS.forEach(function(methodName) { | ||
assert.expectAssertion(function() { | ||
store[methodName](null); | ||
}, new RegExp(`You need to pass a model name to the store's ${methodName} method`)); | ||
}); | ||
}); |