我是第一次使用 Jest,并且已经使用 Mocha+Chai+Sinon 8 年多了。所以,我承认我会有偏见。
与 Chai 相比,我对 Jest 的第一印象
例如,令人惊讶的是,在 Jest 中创建以下对象测试是多么困难:
这是我写的:
开玩笑
expect(Array.isArray(response['output']['data']['results'])).toBe(true);
expect(response['output']['data']['results'].length > 0).toBe(true);
柴
expect(response['output']['data']['results']).to.be.an('array').not.empty;
请求
谢谢