小编Jul*_*his的帖子

'.toMatchObject'和'objectContaining'之间有什么区别?

我写了以下测试:

it('Can decrement the current step', function () {
    expect(reducer(TestState, { type: 'GOTO_PREVIOUS_STEP' })).toMatchObject({ currentStep: 4 });
});

it('Can decrement the current step v2', function () {
    expect(reducer(TestState, { type: 'GOTO_PREVIOUS_STEP' })).toEqual(expect.objectContaining({ currentStep: 4 }));
});
Run Code Online (Sandbox Code Playgroud)

他们俩似乎都通过了考试,他们之间有什么区别吗?他们之间有性能影响吗?

javascript jestjs

42
推荐指数
3
解决办法
2万
查看次数

标签 统计

javascript ×1

jestjs ×1