ts-mocks:打字稿模拟对象

时间:2024-05-22 09:54:56
【文件属性】:

文件名称:ts-mocks:打字稿模拟对象

文件大小:54KB

文件格式:ZIP

更新时间:2024-05-22 09:54:56

TypeScript

Typescript模拟框架(使用Jasmine) 为Typescript类和接口创建类型安全的模拟对象,在模拟方法时会自动创建Jasmine Spy,因此仍然可以使用诸如toHaveBeenCalled()之类的验证方法。 如何使用 基本 初始化和设置新的Mock对象可以通过几种方式完成: // 1. Use the constructor with Partial which is great // because you can use an object with all the setup you want mockCookieService = new Mock < CookieService> ( { get : ( key ) => `customized ${ key } ` } ) ; // 2. Use the 'extend()' m


【文件预览】:
ts-mocks-master
----.gitignore(37B)
----package.json(1KB)
----package-lock.json(182KB)
----src()
--------mocks()
--------index.ts(61B)
----tsconfig.json(330B)
----README.md(12KB)
----karma.conf.ts(697B)
----.vscode()
--------settings.json(41B)
----.npmignore(14B)
----karma.conf.es2015.ts(631B)

网友评论