如何使用茉莉花在钛控制器内对功能进行单元测试

时间:2014-07-11 18:23:25

标签: javascript unit-testing titanium jasmine titanium-alloy

控制器功能:

controllerexample.js

function test() {
    return "works!";
};

controllerexample_specs.js

it('test controllerexample function.', function() {
    $ = Alloy.createController('controllerexample', {});

    expect($.test).toEqual('works!');

});

当我运行脚本时,出现以下错误:

[ERROR] :  .  THERE WERE FAILURES!
[ERROR] :  .  ============================================================
[ERROR] :  .  Recap of failing specs:
[ERROR] :  .  ------------------------------------------------------------
[ERROR] :  .  controllerexample controller test controllerexample function.. - Expected Function to equal 'works!'

0 个答案:

没有答案