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. centos7 安装rabbitmq rabbitmq-c以及amqp扩展 详细篇

    自己鼓捣了一晚上总算整明白了,有几个坑分享给小伙伴,希望能帮到你 前期准备 安装erlang 下载rpm包地址:https://github.com/rabbitmq/erlang-rpm (注意er ...

  2. django 12天(跨域,文件上传,下载,cookie,session)

    django 12天(跨域,文件上传,下载) 跨域 什么是跨域 1.协议不同 2.端口不同 3.主机不同 如何解决跨域 1.安装django-cors-headers模块 2.在settings.py ...

  3. Python9-文件操作-day8

    # 1.文件路径:d:\xxx.txt# 绝对路径:从根目录开始# 想对路径:当前文件下# 2.编码方式:utf-8/gbk...# 3.操作方式:只读.只写.追加.读写.写读..... f=open ...

  4. 编写个makefile文件测试patsubst 的作用

    1 SRCS := $(wildcard *.c) 2 OBJS := $(patsubst %.c,%.o,$(SRCS) ) //把$(SRCS)中的文件.c全部换成.o文件 3 all: 4 @ ...

  5. The North American Invitational Programming Contest 2018 E. Prefix Free Code

    Consider nn initial strings of lower case letters, where no initial string is a prefix of any other ...

  6. 文本搜索grep知识点总结

    文本搜索工具:grep, egrep     根据用户指定的模式对目标文件进行过滤,显示被模式匹配到的行     grep [OPTION]... 'PATTERN' FILE...          ...

  7. Django之单表的增删改查

      books/urls.py   """books URL Configuration The `urlpatterns` list routes URLs to vi ...

  8. 用ajax异步请求一个块

    使用用户控件,作为一个块,生成一段独立的html. 请求一个一般应用程序,在一般应用程序中加载读取用户控件,并给用户控件传值.     Page page = new Page();          ...

  9. hdu 1527 威佐夫博弈

    取石子游戏 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submi ...

  10. CSU-1803: 2016 ,同余定理!

    int main() {     int n,m;     while(~scanf("%d%d",&n,&m))     {         int r1=n/2 ...