Test utilities to generate location-related data.
- Source:
Methods
(static) location(dataopt) → {Promise.<Location>}
- Source:
Generates a random location record and saves it to the database.
All of the generated location's properties are assigned random values unless
changed with the data
argument.
const locationFixtures = require('../spec/fixtures/location');
const location = await locationFixtures.location({
name: 'Custom name'
});
console.log(location.get('name')); // "Custom name"
console.log(location.get('short_name')); // "Lorem ipsum"
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
object |
<optional> |
{}
|
Custom location data. Properties
|
Returns:
A promise that will be resolved with the saved location.
- Type
- Promise.<Location>
(static) name() → {string}
- Source:
Generates a unique random location name.
const locationFixtures = require('../spec/fixtures/location');
locationFixtures.name(); // "Lorem ipsum aute ad dolor exercitation labore amet"
Returns:
A name for a location.
- Type
- string
(static) shortName() → {string}
- Source:
Generates a unique random location short name.
const locationFixtures = require('../spec/fixtures/location');
locationFixtures.shortName(); // "Lorem"
Returns:
A short name for a location.
- Type
- string