Meteor 流星测试摩卡简单反应渲染-未找到方法

Meteor 流星测试摩卡简单反应渲染-未找到方法,meteor,reactjs,mocha.js,meteor-react,Meteor,Reactjs,Mocha.js,Meteor React,我正在尝试编写一个测试,测试数据库中有数据时组件的呈现方式,遇到以下错误: insert failed: Method '/residents/insert' not found 这是我的测验 client/prospects/Prospect.tests.js import { Meteor } from 'meteor/meteor'; import React from 'react'; import { mount, shallow } from 'enzyme'; import P

我正在尝试编写一个测试,测试数据库中有数据时组件的呈现方式,遇到以下错误:

insert failed: Method '/residents/insert' not found

这是我的测验

client/prospects/Prospect.tests.js

import { Meteor } from 'meteor/meteor';
import React from 'react';
import { mount, shallow } from 'enzyme';
import Prospects from './Prospects'
import { chai } from 'meteor/practicalmeteor:chai'
import { resetDatabase } from 'meteor/xolvio:cleaner';
import { Factory } from 'meteor/dburles:factory'
import { Residents } from './../../collections/residents.jsx';
import StubCollections from 'meteor/hwillson:stub-collections';
import { Random } from 'meteor/random';


describe('Prospects', () => {

  if (Meteor.isServer) return;

  it('renders with no prospects', () => {
    const item = mount(<Prospects />);
    chai.assert(item.find('p').hasClass('no-prospects'))
  });

  it('renders with prospects', () => {
    StubCollections.stub(Residents);
    Residents.insert({
      cId: Random.id(),
      name: {first: "John", last: "Smith"},
      status: 'prospect',

      chai.assert(item.find('p').hasClass('prospects'))
    })
  });
});
有人知道我为什么会犯这样的错误吗

import { Mongo } from 'meteor/mongo'
import { Factory } from 'meteor/dburles:factory'
import faker from 'meteor/practicalmeteor:faker';
import { Random } from 'meteor/random';

export const Residents = new Mongo.Collection('residents')

const productTypeSchema = new SimpleSchema({
  list: {type: [String], optional: true},
  other: {type: String, optional: true}
})

const residentSchema = new SimpleSchema({
  cId:    { type: String },
  name:   { type: nameSchema },
  status: { type: String }
})

Residents.attachSchema(residentSchema)


// METHODS
Meteor.methods({
  'residents.insert'(resident) {
    Residents.insert(resident)
  }
})



// PUBLICATIONS
if(Meteor.isServer) {
  Meteor.publish('residents', function() {
    return Residents.find()
  })

  Meteor.publish('resident', function(id) {
    return Residents.find({_id: id})
  })
}