DatabaseSetupQueryBuilder
|
- |
5 |
setupQueriesForTable
|
- |
5 |
should return the queries for creating the table and the primary unique index
|
- |
|
should correctly create join tables for models that have queryable collections
|
- |
|
should use the correct column type for each attribute
|
- |
|
when the model provides additional sqlite config
|
- |
2 |
the setup method should return these queries
|
- |
|
should not fail if additional config is present, but setup is undefined
|
- |
|
Database
|
- |
14 |
find
|
- |
findBy
|
- |
2 |
should pass the provided predicates on to the ModelQuery
|
- |
|
should return a ModelQuery ready to be executed
|
- |
|
findAll
|
- |
2 |
should pass the provided predicates on to the ModelQuery
|
- |
|
should return a ModelQuery ready to be executed
|
- |
|
modelify
|
- |
when given an array or input that is not an array
|
- |
when given an array of mixed ids and models
|
- |
when the input is only IDs
|
- |
when the input is all models
|
- |
count
|
- |
2 |
should pass the provided predicates on to the ModelQuery
|
- |
|
should return a ModelQuery configured for COUNT ready to be executed
|
- |
|
inTransaction
|
- |
8 |
calls the provided function inside an exclusive transaction
|
- |
|
preserves resolved values
|
- |
|
always fires a COMMIT, even if the body function fails
|
- |
|
can be called multiple times and get queued
|
- |
|
carries on if one of them fails, but still calls the COMMIT for the failed block
|
- |
|
is actually running in series and blocks on never-finishing specs
|
- |
|
can be called multiple times and preserve return values
|
- |
|
can be called multiple times and get queued
|
- |
|
DatabaseTransaction
|
- |
23 |
execute
|
- |
persistModel
|
- |
2 |
should throw an exception if the model is not a subclass of Model
|
- |
|
should call through to persistModels
|
- |
|
persistModels
|
- |
7 |
should call transactionDidCommitChanges with a change that contains the models
|
- |
|
should call through to _writeModels after checking them
|
- |
|
should throw an exception if the models are not the same class, since it cannot be specified by the trigger payload
|
- |
|
should throw an exception if the models are not a subclass of Model
|
- |
|
mutationHooks
|
- |
3 |
should run pre-mutation hooks, wait to write models, and then run post-mutation hooks
|
- |
|
should carry on if a pre-mutation hook throws
|
- |
|
should carry on if a pre-mutation hook rejects
|
- |
|
unpersistModel
|
- |
2 |
should delete the model by id
|
- |
|
should call transactionDidCommitChanges with a change that contains the model
|
- |
|
when the model has collection attributes
|
- |
when the model has joined data attributes
|
- |
_writeModels
|
- |
12 |
should compose a REPLACE INTO query to save the model
|
- |
|
should save the model JSON into the data column
|
- |
|
when the model defines additional queryable attributes
|
- |
2 |
should populate additional columns defined by the attributes
|
- |
|
should use the JSON-form values of the queryable attributes
|
- |
|
when the model has collection attributes
|
- |
2 |
should delete all association records for the model from join tables
|
- |
|
should insert new association records into join tables in a single query, and include queryableBy columns
|
- |
|
model collection attributes query building
|
- |
3 |
should page association records into multiple queries correctly
|
- |
|
should page association records into multiple queries correctly
|
- |
|
should page association records into multiple queries correctly
|
- |
|
when the model has joined data attributes
|
- |
3 |
should not include the value to the joined attribute in the JSON written to the main model table
|
- |
|
should write the value to the joined table if it is defined
|
- |
|
should not write the value to the joined table if it undefined
|
- |
|
ModelRegistry
|
- |
5 |
registerDeferred
|
- |
1 |
can register constructors
|
- |
|
has
|
- |
1 |
tests if a constructor is in the registry
|
- |
|
deserialize
|
- |
3 |
deserializes the objects for a constructor
|
- |
|
throws an error if the object can't be deserialized
|
- |
|
throws if the registered constructor was not a model subclass
|
- |
|
Model
|
- |
14 |
constructor
|
- |
2 |
should accept a hash of attributes and assign them to the new Model
|
- |
|
automatically assigns an id to the model if no id is provided
|
- |
|
attributes
|
- |
2 |
should return the attributes of the class
|
- |
|
should guard against accidental modification
|
- |
|
clone
|
- |
fromJSON
|
- |
6 |
should assign attribute values by calling through to attribute fromJSON functions
|
- |
|
should not touch attributes that are missing in the json
|
- |
|
should not do anything with extra JSON keys
|
- |
|
should maintain empty string as empty strings
|
- |
|
Attributes.Number
|
- |
Attributes.JoinedData
|
- |
Attributes.Collection
|
- |
2 |
should parse and inflate items
|
- |
|
should be fine with malformed arrays
|
- |
|
Attributes.Boolean
|
- |
toJSON
|
- |
2 |
should return a JSON object and call attribute toJSON functions to map values
|
- |
|
should surface any exception one of the attribute toJSON functions raises
|
- |
|
matches
|
- |
2 |
should run the matchers and return true iff all matchers pass
|
- |
|
should pass itself as an argument to the matchers
|
- |
|
MutableQueryResultSet
|
- |
15 |
clipToRange
|
- |
7 |
should do nothing if the clipping range is infinite
|
- |
|
should correctly trim the result set 5-10 to the clipping range 2-9
|
- |
|
should correctly trim the result set 5-10 to the clipping range 5-10
|
- |
|
should correctly trim the result set 5-10 to the clipping range 6
|
- |
|
should correctly trim the result set 5-10 to the clipping range 100-200
|
- |
|
should correctly trim the result set 5-10 to the clipping range 0-2
|
- |
|
should trim the models cache to remove models no longer needed
|
- |
|
addIdsInRange
|
- |
8 |
when the set is currently empty
|
- |
when the set has existing values
|
- |
8 |
should throw an exception if the range provided doesn't intersect (trailing)
|
- |
|
should throw an exception if the range provided doesn't intersect (leading)
|
- |
|
should work if the IDs array is shorter than the result range they represent (addition)
|
- |
|
should work if the IDs array is shorter than the result range they represent (replacement)
|
- |
|
should correctly add ids (trailing) and update the offset
|
- |
|
should correctly add ids (leading) and update the offset
|
- |
|
should correctly add ids (middle) and update the offset
|
- |
|
should correctly add ids (middle+trailing) and update the offset
|
- |
|
QueryRange
|
- |
9 |
@infinite
|
- |
@rangesBySubtracting
|
- |
7 |
should throw an exception if either range is infinite
|
- |
|
should return one or more ranges created by punching the provided range
|
- |
|
isInfinite
|
- |
start
|
- |
end
|
- |
isContiguousWith
|
- |
2 |
should return true if either range is infinite
|
- |
|
should return true if the ranges intersect or touch, false otherwise
|
- |
|
ModelQuery
|
- |
23 |
where
|
- |
7 |
should accept an array of Matcher objects
|
- |
|
should accept a single Matcher object
|
- |
|
should append to any existing where clauses
|
- |
|
should accept a shorthand format
|
- |
|
should return the query so it can be chained
|
- |
|
should immediately raise an exception if an un-queryable attribute is specified
|
- |
|
should immediately raise an exception if a non-existent attribute is specified
|
- |
|
order
|
- |
4 |
should accept an array of SortOrders
|
- |
|
should accept a single SortOrder object
|
- |
|
should extend any existing ordering
|
- |
|
should return the query so it can be chained
|
- |
|
include
|
- |
2 |
should throw an exception if the attribute is not a joined data attribute
|
- |
|
should add the provided property to the list of joined properties
|
- |
|
includeAll
|
- |
1 |
should add all the JoinedData attributes of the class
|
- |
|
response formatting
|
- |
sql
|
- |
9 |
should finalize the query so no further changes can be made
|
- |
|
should correctly generate queries with multiple where clauses
|
- |
|
should correctly escape single quotes with more double single quotes (LIKE)
|
- |
|
should correctly escape single quotes with more double single quotes (equal)
|
- |
|
should correctly generate COUNT queries
|
- |
|
should correctly generate LIMIT 1 queries for single items
|
- |
|
should correctly generate contains queries using JOINS
|
- |
|
should correctly generate queries with the class's naturalSortOrder when one is available and no other orders are provided
|
- |
|
should correctly generate queries requesting joined data attributes
|
- |
|
QuerySubscriptionPool
|
- |
5 |
add
|
- |
5 |
should add a new subscription with the callback
|
- |
|
should yield database changes to the subscription
|
- |
|
unsubscribe
|
- |
3 |
should return an unsubscribe method
|
- |
|
should remove the callback from the subscription
|
- |
|
should wait before removing the subscription to make sure it's not reused
|
- |
|
QuerySubscription
|
- |
8 |
constructor
|
- |
3 |
should finalize the query
|
- |
|
should throw an exception if the query is a count query, which cannot be observed
|
- |
|
should call update to initialize the result set
|
- |
|
when initialModels are provided
|
- |
query
|
- |
addCallback
|
- |
applyChangeRecord
|
- |
1 |
scenarios
|
- |
1 |
spec/query-subscription-spec.js |
- |
|
update
|
- |
4 |
when the query has an infinite range
|
- |
2 |
should call _fetchRange for the entire range
|
- |
|
should fetch full full models only when the previous set is empty
|
- |
|
when the query has a range
|
- |
2 |
when we have no current range
|
- |
when we have a previous range
|
- |
2 |
should call _fetchRange with the missingRange
|
- |
|
should call _fetchRange for the entire query range when the missing range encompasses more than one range
|
- |
|