ReferenceError: post is not defined

Ok so i have this method and this schema

‘post.add’(data) {
if (!this.userId) {
throw new Meteor.Error(‘not-authorized’);
}
data.userId = this.userId;
console.log(data);
Posts.insert ({
text: post,
createdAt: new Date(),
userId: this.userId
});
/////////
export default new SimpleSchema({
text:{type: String, label: “post”, max: 100, min: 3,},
createdAt: {type : Date},
userId:{type : String},

});

but i keep getting this error,
I20170509-16:40:41.986(3)? { post: ‘brrr’, userId: ‘HKfZSSKY6Zbwudh9G’ }
I20170509-16:40:42.615(3)? Exception while invoking method ‘post.add’ ReferenceError: post is not defined
I20170509-16:40:42.625(3)? at [object Object].postAdd (imports/api/posts/methods.js:37:19)
I20170509-16:40:42.627(3)? at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1711:12)
I20170509-16:40:42.632(3)? at packages/ddp-server/livedata_server.js:711:19
I20170509-16:40:42.633(3)? at [object Object]..extend.withValue (packages\meteor.js:1122:17)
I20170509-16:40:42.639(3)? at packages/ddp-server/livedata_server.js:709:40
I20170509-16:40:42.641(3)? at [object Object].
.extend.withValue (packages\meteor.js:1122:17)
I20170509-16:40:42.644(3)? at packages/ddp-server/livedata_server.js:707:46
I20170509-16:40:42.648(3)? at Session.method (packages/ddp-server/livedata_server.js:681:23)
I20170509-16:40:42.653(3)? at packages/ddp-server/livedata_server.js:551:43

can someone give me a hint how to define “post” or where to look?

and how can i define it

OK. I’ll assume you’re passing this in through the data parameter of your method.

In which case, you might use text: data, if data is a string, or maybe text: data.post, if data is an object with a post property (which is a string).

As I don’t know what you’re passing in, I can’t actually give you a straight answer.

1 Like

I am also getting same error: Failed: POST is not defined

I am running one test case, this error comes up in between of one of the page.

My config.js is as below:

//var jasmine2HtmlReporter = require(‘C:\Users\ashish_saxena\node_modules\protractor-jasmine2-html-reporter’);

exports.config={
framework: ‘jasmine’,
seleniumAddress: ‘http://localhost:4444/wd/hub’,
specs:[’…/SpecFiles/FirstSpec.js’],
params:
{
testdata: require(’…/ElementLocators/Elements.json’)
}

}

Please help me in providing solution for this.

Appreciate your help