Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行时对象Worker要怎么mock #47

Open
Zhyannan opened this issue Jun 5, 2023 · 3 comments
Open

运行时对象Worker要怎么mock #47

Zhyannan opened this issue Jun 5, 2023 · 3 comments

Comments

@Zhyannan
Copy link

Zhyannan commented Jun 5, 2023

如果要写UT的话,运行时对象Worker要怎么mock?

@8treenet
Copy link
Owner

8treenet commented Jun 5, 2023

unitTest := getUnitTest()
unitTest.SetRequest(mock)
unitTest.Run()

https://github.com/8treenet/freedom/blob/master/example/fshop/domain/goods_test.go

@Zhyannan
Copy link
Author

Zhyannan commented Jun 6, 2023

控制器层的UT,是不是要项目启动了才能跑,不能单独跑?

@8treenet
Copy link
Owner

8treenet commented Jun 7, 2023

控制器不需要单测吧,有 http 的路由属性了. 并且控制器也没业务逻辑

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants