Awesome
comerc:autoform-fixtures
Get fixtures data from SimpleSchema with AutoForm.
Usage
It is creating random/fake data automatically based on the collection schema.
ss = Collections.MyCollection.simpleSchema()
data = AutoForm.Fixtures.getData(ss)
Collections.MyCollection.insert(data)
You may use autoform.omit
for exclude fields:
MyCollection.attachSchema new SimpleSchema
userId:
type: String
autoform:
omit: true
autoValue: ->
Meteor.userId()
You may use anti:fake with getFakeTextCallback
getFakeText = (fieldName, maxLength) ->
if fieldName is "my.name"
Fake.word()
else if maxLength
Fake.sentence(Math.round(maxLength / 10))
else
Fake.paragraph()
data = AutoForm.Fixtures.getData(ss, getFakeText)
You may use intermediate operations with namespace in mongo-style
data = AutoForm.Fixtures.getPreData(ss)
data["my"] = {}
data["my.name"] = "foo"
data = AutoForm.Fixtures.normalizeData(data)
# {my: name: "foo"}