Releases: adopted-ember-addons/ember-data-factory-guy
Releases · adopted-ember-addons/ember-data-factory-guy
v3.1.7
- made parseUrl more robust ( was affecting mockLinks update from v.3.1.6 )
v3.1.6
- Improve mockLinks to handle url with query parameters.
- links are kind of a black box that you can not touch very easily, and the mockLinks helper allows you to mock a links relationship, but now that works for links with query parameters so life is better again
Example:
let propertiesLink = '/users/1/properties?dudes=2',
user = make('user', {properties: {links: propertiesLink}}),
json = buildList('property', 1),
mockProperties = mockLinks(user, 'properties').returns({json});
const properties = await user.properties.toArray(); // 1 property model
-
mockLinks automatically breaks that url apart into the url and query params for you
-
alternatively you could use mock
mock({url: '/users/1/properties/'}).withParams({dudes: 2}).returns(json);
v3.1.5
- fixes using makeList, buildList when specifying 0 #348 @patocallaghan @lorcan
Example:
let noUsers1 = makeList('user', 0);
let noUsers2 = makeList('user', 0, 'with_hats', {name: 'Pat'});
Both of these now correctly give you no users ( empty list )
v3.1.4
- mock ( used for mocking any url ) can now handle query parameters
Example:
const type = 'GET',
url = '/api/get-stuff',
whatsUp = {whats: 'up'},
message = {message: 'nothing much doc'}
let theMock = mock({url}).withParams(whatsUp).returns(message);
let json = await Ember.$.ajax({type, url, data: whatsUp});
json // => {message: 'nothing much doc'}
v3.1.3
- fixes #344 to pass in request body when matching mockUpdates with function @roschaefer
mockCreate('project').match(requestBody => {
return requestBody.data.attributes.title === 'titleToMatch';
});
v3.1.2
v3.1.1
- use run.join in make function #339 @Subtletree
- add getPretender function #338 @ryedeer
v3.1.0
- bump ember source/ data / cli to 3.1
v3.0.3
- fixes #337 by clarifying that mockFindAll can have query params and they will be used first like mockQuery will when the request has query params
Example:
let mockF = mockFindAll('user', 2),
mockFQ = mockFindAll('user', 1).withParams({foo: true}),
mockQ = mockQuery('user', {moo: true});
store.findAll('user') // mockF used
store.findAll('user'}) // with url "/users?foo=true" mockFQ used
store.query('user', {foo: true}) // mockFQ used
store.query('user', {moo: true}) // mockQ used
v3.0.2
- fixed issue where relationships did not have parentType, that was introduced in 3.0.1