我试图自学使用Meteor进行测试,但网上有太多相互冲突和过时的信息,我真的很难弄清楚我需要做什么。
我目前的情况是,我有一个使用最新Meteor版本(以及imports文件夹结构)的应用程序。
我已经全局安装了黑猩猩,并创建了一个/tests目录。
我的第一个测试是使用chimp/mocha来填写表单,并尝试向数据库中插入内容。我还使用了xolvio/backdoor包,并像这样运行黑猩猩
chimp --ddp=http://localhost:3000 --mocha --path=tests
下面是我的测试代码:
describe('Chimp Mocha', function() {
describe( 'Create a Client', function() {
it( 'should fill in add client form', function() {
browser.setValue('#clientName', 'Test')
.setValue('#clientEmail', 'test@test.com')
.selectByValue('#numberTeamMembers', '25')
.submitForm('#createClient')
});
it( 'should check the collections for new client data', function() {
let getClient = server.execute( function() {
return Clients.findOne({ name: 'Test' });
});
expect( getClient.name ).to.equal( 'Test' );
});
after( function() {
server.execute( function() {
let client = Clients.findOne( { name: 'Test' } );
if ( client ) {
Clients.remove( client._id );
}
});
});
});
});这将抛出客户端未定义的错误
但是,如果我添加
import { Clients } from '/imports/api/clients/clients.js';
我得到这个错误Error: Cannot find module '/imports/api/clients/clients.js'
我做错了什么?我应该用黑猩猩吗?任何帮助都是非常感谢的,因为我发现流星指南对此并不是很清楚!
谢谢
发布于 2016-11-28 02:50:07
https://stackoverflow.com/questions/40824956
复制相似问题