【发布时间】:2016-12-09 05:06:57
【问题描述】:
我有一个正在解析的 JSON 对象,我正在为输出编写测试,但我无法在运行时检查特定对象是否符合流类型。
const object = {/**/}
type SomeType = {
foo: string,
bar: bool,
baz: Object,
}
describe('object', () => {
describe('.subfield', () => {
it('conforms to SomeType', () => {
// Here I want to write an 'expect'
// that checks if object.subfield
// conforms to the SomeType flow type?
})
});
});
有什么方法可以实现吗?
【问题讨论】:
标签: javascript unit-testing flowtype