I have wrote simple unit test. The part of it is:
import { Meteor } from 'meteor/meteor';
import { expect } from 'chai';
import { Mongo } from 'meteor/mongo';
import { Notifications } from './../notifications';
const nOne = {
userId: 445566,
post: {
_id: 'postId',
image: 'image URL',
text: 'text of the post',
company_name: 'text',
company_source: 'someURL'
},
coords: {latitude:59, longitude:30}
}
if (Meteor.isServer) {
describe ('notifications ', function () {
beforeEach(function() {
Notifications.remove({});
});
it ('some test', function () {
Meteor.server.method_handlers['notifications.add'].apply({},[nOne]);
});
})
}
And the problem is that nOne.coords before the test is {latitude:59, longitude:30}
but after call meteor method it [{latitude:59, longitude:30}] - an array;
how is it possible that Meteor method change const. And change it from Object to [Object] ?