Fixture converter does not pass transform options to transform function
paddyobrien opened this issue · 2 comments
paddyobrien commented
When serializing an attribute with a transform the fixture converter does not pass the options
property to Transformer.serailize
meaning any transform that relies on these opts will fail.
i.e. if I have a model 'my-model' with a custom transform:
export default DS.Model.extend({
someProp: DS.attr('my-custom-transform', { transformWith: SomeTransformer })
})
and a transform like this:
export default DS.Transform.extend({
deserialize(serialized, opts) {...}
serialize(deserialized, options) {
return options.transformWith.serialize(deserialized)
}
}
And I do mockFindRecord('my-model')
in a test, it will raise an exception because options
is undefined in the serialize
hook of my custom transform.
Doing mockFindRecord(make('my-model'))
works fine.
It looks like we should be passing meta.opts
here: https://github.com/danielspaniel/ember-data-factory-guy/blob/master/addon/converter/fixture-converter.js#L180
danielspaniel commented
v3.6.5 has this fix
paddyobrien commented
Thank you for the prompt merge and release!