【发布时间】:2019-04-30 23:29:24
【问题描述】:
我无法执行以下测试,这是什么问题?
test('3 - shorthand syntax', function () {
const name = 'Myamoto';
const age = 32;
const samurai = { name, age };
expect(samurai).toEqual(age: 32, name: "Myamoto");
});
【问题讨论】:
-
.toEqual(age: 32, name: "Myamoto");语法无效...参数列表不是对象... -
我能做到:expect(samurai).toEqual(samurai);但我猜这不是传递对象的方式?
-
在深入 Jest 之前,您可能会考虑弄清楚基本的 JS 语法规则,可能会更容易一些
标签: javascript jestjs