【问题标题】:meteor + velocity + jasmine-unit stuck at loading流星+速度+茉莉花单元卡在加载中
【发布时间】:2014-09-10 04:07:32
【问题描述】:

我想知道为什么这个 jasmine-unit 测试会卡在“加载”中。

这是我的测试,addUser 在服务器端调用 Accounts.createUser() 方法,完成后通常返回添加用户的 id:

(function () {
    "use strict";

    var InsertUser = function()
    {
        var id;

        id = Meteor.methodMap.addUser('asd@asd.asd', 'asdasd', 'John', 'Doe', 'not yet', '070-111 22 33', 'ididididid', 'admin', 'info admin john', 0);

        console.log("1. call method: " + id);

        this.getIdOfUser = function()
        {
            return id;
        };
    };

    describe("User functions", function ()
    {
        var userInsert;

        beforeEach(function(done)
        {
            setTimeout(function() {
                userInsert = new InsertUser();
                console.log("2. before each");
                done();
            }, 1000);
        });

        it("Add user return value", function(done)
        {
            spyOn(userInsert, 'getIdOfUser');

            console.log("3. use spy");

            expect(userInsert.getIdOfUser).toHaveBeenCalled();
            done();
        });
    });
})();

我这里尝试使用异步调用addUser的方式获取服务端方法返回的id。

如果我从浏览器控制台手动调用“addUser”方法,则添加用户有效。

【问题讨论】:

    标签: unit-testing meteor jasmine velocity


    【解决方案1】:

    尝试使用DEBUG=1 JASMINE_DEBUG=1 VELOCITY_DEBUG=1 VELOCITY_DEBUG_MIRROR=1 mrt 启动应用程序,这样您就可以查看在测试执行期间是否抛出任何错误。

    【讨论】:

      【解决方案2】:

      据我所知,您还必须在 http://localhost:5000 打开镜像应用程序。有帮助吗?还要在控制台中检查镜像应用程序是否正确打开。

      【讨论】:

        猜你喜欢
        • 2014-09-26
        • 2015-11-01
        • 2015-04-24
        • 1970-01-01
        • 2020-08-19
        • 1970-01-01
        • 2016-06-14
        • 2015-02-26
        相关资源
        最近更新 更多