Fill: toMatchSnapshot
填空题 中等
题目
Fill in 空白到 use snapshot 测试:
代码
test('snapshot', () => {
expect({ name: 'Alice' }).___();
});
提示
matcher name 包含 'Snapshot'.
解释
正确答案是 toMatchSnapshot. 这个 matcher captures 值 on 首先运行 and 保存它 到 snapshot file. On subsequent 运行, 它 compares current 值到 保存 snapshot and 失败如果它们 differ.
相关资源
相关课程
- Snapshot 测试
Using snapshots effectively.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。