Hi all.
In server folder I have file with description some Meteor methods. Smth like this
Meteor.methods({
sumCoords(lat:number, lng:number)
{...;
return lat+lng
}
I created test-file in client folder test.spec.ts:
describe('Test coordinates method', () => {
beforeEach(() => {
});
test('You should have equal values', () => {
const a = Meteor.call('sumCoords',34,45);
expect(a).toBe(79);
});
Then I’m starting this test and get error
ReferenceError: Meteor is not defined
22 |
23 |
> 24 | const a = Meteor.call('sumCoords',34,45);
25 | expect(a).toBe(79);
26 | });
27 |
at client/imports/app/shared/location.spec.ts:24:11
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:388:26)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/dist/proxy.js:79:39)
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:387:32)
at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/dist/zone.js:138:43)
at Object.testBody.length (node_modules/jest-zone-patch/index.js:50:27)
Another tests are working and showing “PASS” in terminal.
I use Meteor method in another files and it works correctly.
I found some answer in Google and tried to add import { Meteor } from 'meteor/meteor';
but get the same test-fail with error Cannot find module 'meteor/meteor' from 'location.spec.ts'
Can you help, please.