如题,
比如
function random (n = 2) {
return Math.floor((Math.random()*n+1))
}
// jest中:
expect(random()).toBe(1 or 2)
期待的值可能是数组
如题,
比如
function random (n = 2) {
return Math.floor((Math.random()*n+1))
}
// jest中:
expect(random()).toBe(1 or 2)
期待的值可能是数组
expect([1, 2]).toContain(random());