I need to test a snapshot which has also a property called aria-labelledby
and created by some function that I cannot modify or mock.
(我需要测试一个快照,该快照也具有一个称为aria-labelledby
的属性,并且由无法修改或模拟的某些函数创建。)
Everytime when I run the test, that property gets a new value which also I don't care what it is.(每当我运行测试时,该属性都会获得一个新值,我也不在乎它是什么。)
So, is there a way to mention the aria-labelledby
to be not checked?
(因此,有没有办法提及不被检查的aria-labelledby
?)
Test
(测试)
it('My Test', () => {
let wrapper: ReactWrapper;
wrapper = mount(<App />);
expect(wrapper.find(App)).toMatchSnapshot();
});
Snapshot
(快照)
.....
}
unmountOnExit={false}
>
<div
- aria-labelledby="pr_id_1_label" <===== SNAPSHOT VALUE
+ aria-labelledby="pr_id_2_label" <===== NEW VALUE WHICH CAUSES THE TEST FAIL!!!!
className="p-dialog p-component"
.....
ask by Korki Korkig translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…