Most of time, when we want to test function call inside a promise, we can do:

it('Should be async', function(done) {
someAsyncFunction().then(function(result) {
expect(result).toBe(true);
done();
});
});

It is important to call 'done()', otherwise, the code won't call the promise is finished.

[Unit Testing] Test async function with Jasmine的更多相关文章

  1. [Unit Testing] AngularJS Unit Testing - Karma

    Install Karam: npm install -g karma npm install -g karma-cli Init Karam: karma init First test: 1. A ...

  2. [Unit Testing] Unit Test a Function that Invokes a Callback with a Sinon Spy

    Unit testing functions that invoke callbacks can require a lot of setup code. Using sinon.spy to cre ...

  3. Unit Testing, Integration Testing and Functional Testing

    转载自:https://codeutopia.net/blog/2015/04/11/what-are-unit-testing-integration-testing-and-functional- ...

  4. Unit Testing with NSubstitute

    These are the contents of my training session about unit testing, and also have some introductions a ...

  5. Javascript单元测试Unit Testing之QUnit

    body{ font: 16px/1.5em 微软雅黑,arial,verdana,helvetica,sans-serif; }           QUnit是一个基于JQuery的单元测试Uni ...

  6. C/C++ unit testing tools (39 found)---reference

    http://www.opensourcetesting.org/unit_c.php API Sanity AutoTest Description: An automatic generator ...

  7. Unit Testing a zend-mvc application

    Unit Testing a zend-mvc application A solid unit test suite is essential for ongoing development in ...

  8. Unit Testing PowerShell Code with Pester

    Summary: Guest blogger, Dave Wyatt, discusses using Pester to analyze small pieces of Windows PowerS ...

  9. C# Note36: .NET unit testing framework

    It’s usually good practice to have automated unit tests while developing your code. Doing so helps y ...

随机推荐

  1. Android开发——Activity启动模式详解

    1. Activity的启动模式 本文原创,转载请注明出处:http://blog.csdn.net/seu_calvin/article/details/52054893 1.1 Standard标 ...

  2. Ubuntu新装系统要装软件

    1. 在虚拟机中新安装系统的时候,通常因为时间过了很长,软件有更新之后,安装vim的时候会出错,因此,装完系统先要做的: cd /var/lib/dpkg/updates/ ls sudo apt-g ...

  3. 如何完整反编译AndroidMainfest.xml

    下载工具: http://code.google.com/p/android4me/downloads/detail?name=AXMLPrinter.zip&can=2&q= 包名为 ...

  4. jmeter压力测试入门

    http://www.51testing.com/html/80/n-853680.html http://blog.csdn.net/vincy_zhao/article/details/70238 ...

  5. linux 安装SNV服务

    1.安装vnc server[root@pxe ~]# yum install tigervnc-server -y 2.设置 vnc server 开机启动[root@pxe ~]# chkconf ...

  6. 给定一颗二叉搜索树,请找出其中的第k大的结点。例如, 5 / \ 3 7 /\ /\ 2 4 6 8 中,按结点数值大小顺序第三个结点的值为4。

    /* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x ...

  7. x86保护模式 控制寄存器和系统地址寄存器

    控制寄存器和系统地址寄存器 控制寄存器    crx cr0   指示cpu工作方式的控制位  包含启用和禁止分页管理机制的控制位  包含控制浮点协处理器操作的控制位   注意必须为0的位 cr2和c ...

  8. 九度oj 题目1135:字符串排序

    题目描述: 先输入你要输入的字符串的个数.然后换行输入该组字符串.每个字符串以回车结束,每个字符串少于一百个字符. 如果在输入过程中输入的一个字符串为“stop”,也结束输入. 然后将这输入的该组字符 ...

  9. MAC生成公钥私钥

    前言 需要开发者在本地上使用openssl来生成私钥和公钥 由于mac 自带openssl工具,所以不用像windows那样要下载安装openssl工具 步骤 1.创建一个文件夹,终端进入该文件夹 c ...

  10. VIJOS 1889 天真的因数分解 ——莫比乌斯函数

    同理BZOJ2440 二分答案,不过这次变成了统计含有平方因子的个数 #include <cmath> #include <cstdio> #include <cstri ...