我想写测试的承诺结果,我dot'n想解决承诺在每个it/pit
部分。jest - 在测试前解决承诺
我需要水木清华这样的:
describe('getData() results test',() => {
return getData().then(response => {
it('foo',() => expect(response.foo).toEqual(1));
it('bar',() => expect(response.bar).toEqual(2));
it('bar',() => expect(response.bar).toEqual(3));
});
});
如果使用beforeEach
- 承诺将得到解决多次的it
节的数目。我需要解决它一次,然后测试响应。有很多测试用例,所以我想分割所有测试到it
部分
在你的例子中promise会被解析3次。我需要解决一次,然后测试响应。有很多测试用例,所以我想把所有的测试都分成“它”部分 – tuchk4
“应该返回正在测试的承诺。”有承诺的“坑”部分。但现在似乎'它'可以使用 – tuchk4