app/lib/warehouse

Serves mock data for tests
Source:

Methods

(static) itemDataObject(contentType) → {Object}

Returns mock item data object corresponding to given contentType
Parameters:
Name Type Description
contentType Object ContentType
Source:
Returns:
Item data object
Type
Object

(static) itemDataObjects(contentTypeopt, countopt) → {Array.<Object>}

Returns collection of mock item data objects corresponding to given contentType
Parameters:
Name Type Attributes Default Description
contentType Object <optional>
ContentType
count string <optional>
234 Total number of itemDataObjects to return
Source:
Returns:
Item data objects
Type
Array.<Object>

(static) itemPage(sourceopt, contentTypeopt, userSourceAuthopt, overwriteProperties) → {Array.<Object>}

Returns mock item page object corresponding to given contentType, source and userSourceAuth, if provided
Parameters:
Name Type Attributes Description
source Object <optional>
Source
contentType Object <optional>
ContentType
userSourceAuth Object <optional>
UserSourceAuth
overwriteProperties Object Properties that should overwrite standard item page object properties (optional)
Source:
Returns:
Item page object
Type
Array.<Object>

(static) itemPages(source, contentType, countopt) → {Array.<Object>}

Returns mock item page objects corresponding to given contentType and source
Parameters:
Name Type Attributes Default Description
source Object Source
contentType Object ContentType
count string <optional>
234 Total number of itemDataObjects to return across pages
Source:
Returns:
Item page objects
Type
Array.<Object>

(static) itemRelationships() → {Object}

Returns mock item relationships object
Source:
Returns:
Relationships object
Type
Object

(static) many(modelId, overwritePropertiesopt, countopt) → {Array.<Object>}

Returns collection of mock documents corresponding to given model ID
Parameters:
Name Type Attributes Default Description
modelId string Model ID
overwriteProperties Object <optional>
Properties that should overwrite standard mock properties
count string <optional>
10 Total number of documents to return
Source:
Returns:
Mongoose documents
Type
Array.<Object>

(static) manySaved(modelId, overwritePropertiesopt, countopt, done)

Callbacks collection of saved mock documents corresponding to given model ID
Parameters:
Name Type Attributes Default Description
modelId string Model ID
overwriteProperties Object <optional>
Properties that should overwrite standard mock properties
count string <optional>
15 Total number of documents to return
done function Error-first callback function expecting no other parameters
Source:

(static) mockProperties(modelId, overwriteProperties) → {Object}

Returns object of mock properties corresponding to given model ID
Parameters:
Name Type Description
modelId string Model ID
overwriteProperties Object Properties that should overwrite standard mock properties (optional)
Source:
Returns:
Mongoose document properties
Type
Object

(static) one(modelId, overwritePropertiesopt) → {Object}

Returns one mock document corresponding to given model ID
Parameters:
Name Type Attributes Description
modelId string Model ID
overwriteProperties Object <optional>
Properties that should overwrite standard mock properties. Treated as simply an _id property value if valid ObjectId.
Source:
Returns:
Mongoose document
Type
Object

(static) oneSaved(modelId, overwritePropertiesopt, done)

Callbacks one saved mock document corresponding to given model ID
Parameters:
Name Type Attributes Description
modelId string Model ID
overwriteProperties Object <optional>
Properties that should overwrite standard mock properties
done function Error-first callback function expecting no other parameters
Source: