Namespace: Fixtures

thorn~ Fixtures

Fixtures for pre-creating records.

Methods


<static> cleanup()

Removes all cached records from the server. Additionally, clears the local cache.

Returns:

The ChakramResponse for the delete request to the server.

Type
Promise

<static> create(models [, options])

Using the supplied models, create records and links on the server and cache those records locally.

Parameters:
Name Type Argument Description
models Object | Array.<Object>

An object or array of objects. Each object contains a list of attributes for each new model.

options Object <optional>

Additional information about models.

Properties
Name Type Argument Description
module string <optional>

The module of all models (if not specified in the models' object).

Returns:

The ChakramResponse from the creation of the records and/or links

Type
Promise

Creates link between left and right in the database.

Parameters:
Name Type Description
left Object

Record retrieved from cache.

linkName string

Relationship link name.

right Object

Record retrieved from cache.

Returns:

The result of the request to link the records.

Type
ChakramPromise

<static> lookup(module, properties)

Mimics _.find and using the supplied arguments, returns the cached record.

Parameters:
Name Type Description
module string

The module of the record to find.

properties Object

The properties to search for.

Returns:

The first record in cachedRecords that matches properties.

Type
Object