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

添加单元测试:自动审核逻辑中,测试auto_review_regex未配置时使用默认正则表达式的情况 #2583

Merged
merged 10 commits into from
Apr 12, 2024

Conversation

feiazifeiazi
Copy link
Contributor

todo

@LeoQuote
Copy link
Collaborator

LeoQuote commented Apr 12, 2024

个人认为这件事情可能这样测更方便:

  1. 确认取配置时可以正确取到默认值(很有可能已有测试覆盖
  2. 测试正则检测时的正确性

现在的设计,整个流程测有点太长了,而且不明显,建议你在测试时,就显式设定一些配置,仅对正则匹配进行校验

Copy link

codecov bot commented Apr 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.91%. Comparing base (3df5492) to head (6ba6a77).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2583      +/-   ##
==========================================
+ Coverage   76.90%   76.91%   +0.01%     
==========================================
  Files         117      117              
  Lines       16109    16120      +11     
==========================================
+ Hits        12388    12399      +11     
  Misses       3721     3721              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@feiazifeiazi
Copy link
Contributor Author

feiazifeiazi commented Apr 12, 2024

个人认为这件事情可能这样测更方便:

  1. 确认取配置时可以正确取到默认值(很有可能已有测试覆盖
  2. 测试正则检测时的正确性

现在的设计,整个流程测有点太长了,而且不明显,建议你在测试时,就显式设定一些配置,仅对正则匹配进行校验

1.以下2个场景未覆盖到。
1.1 使用默认正则情况。
1.2 在同样的前置条件下(同一个正则), 要传入不同的SQL,判断方法是否按预期返回False和True,才能覆盖到逻辑。方法内部很多判断,很容易一直返回是False。

简化了SQL
image

@LeoQuote LeoQuote merged commit c83850d into hhyo:master Apr 12, 2024
10 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants