【文件属性】:
文件名称:jest-tobetype:玩笑匹配器,可让您测试值的预期类型
文件大小:34KB
文件格式:ZIP
更新时间:2021-05-02 20:23:16
JavaScript
ToBeType
一个匹配器,允许您测试值的预期类型。
用法
像其他匹配器一样使用它。 例如:
expect ( "" ) . toBeType ( "string" ) ;
expect ( { } ) . toBeType ( "object" ) ;
expect ( 1 ) . toBeType ( "number" ) ;
expect ( [ ] ) . toBeType ( "array" ) ;
expect ( ( ) => { } ) . toBeType ( "function" ) ;
// also works with Promises
expect ( Promise . resolve ( [ ] ) ) . resolves . toBeType ( "array" ) ;
就这么简单,享受!
为什么?
当您只想检查值的类型时,您是否为每次测试都感
【文件预览】:
jest-tobetype-master
----.gitignore(884B)
----package.json(830B)
----package-lock.json(168KB)
----LICENSE(1KB)
----index.js(862B)
----__tests__()
--------test.js(856B)
----README.md(2KB)
----.npmignore(11B)
----index-cjs.js(955B)