在开玩笑的框架中,在进行任何测试之前描述函数调用

时间:2018-07-13 01:42:39

标签: javascript node.js reactjs jestjs

我正在使用Jest框架(version 23.3.0)(node version 6.9.4)来测试javascript代码, 我有一个名为'update board name'的测试。我需要更新板名 基于我在'getBoards Ids'测试中获取的木板ID。 我的问题是描述在测试'getBaords Ids'之前被调用。 因此测试'update board name'永远不会被调用,因为boardIds数组的长度为0。

let boardIds=[];

test('getBoard Ids',()=>{
 //calling api to get board ids
})

describe('boards test',()=>{
for(let i=0;i<=boardIds.length;i++){

    test('update board name',()=>{
           // calling API to update the board name using ids from boardIds array.
        })
    })

}
});
});

在测试之前和之后,我们都有钩子来运行一些代码,但是在描述之前是否可以调用任何钩子?

0 个答案:

没有答案
相关问题