barrels icon indicating copy to clipboard operation
barrels copied to clipboard

Document the structure of fixture files

Open axelpale opened this issue 8 years ago • 3 comments

As a newcomer to Sails and Barrels, I had a hard time to figure out in which format the fixtures should be. I kept thinking how should I create the fixtures, should I just wrote the files, in which format, et cetera. By consuming time to examine the files under test/fixtures/, I now know that they have a structure that is somehow related to the model attributes.

What do you think, is the documentation lacking in this matter? Even a tiny example.json fixture in the README.md with proper description might do the job.

axelpale avatar Sep 06 '16 16:09 axelpale

No problem, feel free to submit a pull request.

bredikhin avatar Sep 06 '16 16:09 bredikhin

@bredikhin Thank you for the quick reply. Currently I do not have enough knowledge about the required fixture files to write documentation about them but if that day comes, I might submit a PR. Should the fixtures always be arrays of objects? Should the properties of the objects match the attributes of Sails Models? Is there some special properties? For example, the model test/fixtures/models/Product.js has attribute name, and the fixture product.js uses property title. Is either one a special value? What if some of the attributes are not given? Is it necessary to give all the attributes?

I am sorry for being difficult, so to say, but I am trying to express the variety of questions running in the mind of a dev that is new to Sails and Barrels.

axelpale avatar Sep 06 '16 17:09 axelpale

The best way to learn is to actually read the code and the existing docs. I'm pretty sure it'll let you come up with a good level of understanding and maybe a comprehensive PR if you feel like it.

bredikhin avatar Sep 06 '16 17:09 bredikhin