我想测试时间是否正确解析,我只对检查一些属性而不是整个对象感兴趣.在这种情况下小时和分钟.
我尝试使用expect(object).toContain(value)但是你可以在下面的代码片段中看到它失败了,尽管该对象包含我感兴趣的属性并且它们具有正确的值.
? Calendar > CalendarViewConfig › it should parse time
expect(object).toContain(value)
Expected object:
{"display": "12:54", "full": 774, "hour": 12, "hours": 12, "minutes": 54, "string": "12:54"}
To contain value:
{"hours": 12, "minutes": 54}
67 | it('it should parse time', () => {
68 | ...
> 69 | expect(parseTime('12:54')).toContain({ hours: 12, minutes: 54})
70 | })
at Object.<anonymous> (src/Components/Views/Calendar/CalendarViewConfig.test.js:69:32)
Run Code Online (Sandbox Code Playgroud) 我读过这个类似问题的答案: Do I need quote for strings in YAML?
但是,对于是否可以使用包含正斜杠的字符串转义引号,没有答案/。
例如,我们是否需要为以下 eslint 规则添加引号'react/no-deprecated': off?
如何进口导入相当于import React, { Component } from 'react-native'?
在typescript(es6模式)中,它只接受,必须分成两个导入:
import * as React from 'react-native'
import { Component } from 'react-native'
Run Code Online (Sandbox Code Playgroud)
我该怎么办?