Members
_callPropertyDefinition
If definition
is a function, calls the function. Otherwise, returns the definition.
- Source
add
Alias for this.store.add
- Source
factories :object
A hash of available factories. A factory is an object with a structure like: { name, type, attributes, relationships }.
- object
- Source
singletons :object
A hash of singleton objects.
- object
- Source
Methods
build(factoryName, overrideOptions, numberOfRecords) → {object}
Allows easy building of Store objects, including relationships. Takes parameters attributes
and relationships
to use for building.
const batchAction = store.build('cropBatchAction') store.build('basilBatch', { arbitrary_id: 'new_id' zone: 'bay1', crop_batch_actions: [ batchAction, store.build('batchAction') ] })
Name | Type | Default | Description |
---|---|---|---|
factoryName | string | the name of the factory to use | |
overrideOptions | object | overrides for the factory | |
numberOfRecords | number | 1 | optional number of models to build |
- Source
instance of an Store model
- Type:
- object
define(name, options)
Creates a factory with { name, type, parent, ...attributesAndRelationships }, which can be used for building test data. The factory is named, with a set of options to use to configure it.
- parent - use another factory as a basis for this one
- type - the type of model to use (for use if no parent)
- identity - whether this factory should be a singleton attributesAndRelationships - attributes and relationships. If properties are a function or an array of functions, they will be executed at runtime.
Name | Type | Description |
---|---|---|
name | string | the name to use for the factory |
options | object | options that can be used to configure the factory |
- Source