Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Enhancement/add unit tests #34

Merged
merged 9 commits into from
Oct 27, 2020

Conversation

fairyhunter13
Copy link
Contributor

@fairyhunter13 fairyhunter13 commented Oct 27, 2020

IMPORTANT: Please do not create a Pull Request without creating an issue first!

(Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request).

Summary

Explains the information and/ motivation for making this changes...

Adding partial unit tests on the matchers package

Proposed of changes

This PR fixes/implements the following bugs/features:

How has this been tested?

Proof:

Running tool: C:\Go\bin\go.exe test -timeout 30s -coverprofile=C:\msys64\tmp\vscode-goKE6Jxj\go-code-cover ktbs.dev/teler/pkg/matchers -race -v

=== RUN   TestIsLogformat
=== RUN   TestIsLogformat/invalid_log_format
[�[31mERR�[0m] Error! Only validates log format; please check your config file
[�[34mINF�[0m] Use "-h" flag for more info about command.
=== RUN   TestIsLogformat/no_$_sign
[�[31mERR�[0m] Error! Only validates log format; please check your config file
[�[34mINF�[0m] Use "-h" flag for more info about command.
=== RUN   TestIsLogformat/nonexist_required_log_format
[�[31mERR�[0m] Error! Only validates log format; please check your config file
[�[34mINF�[0m] Use "-h" flag for more info about command.
=== RUN   TestIsLogformat/valid_log_format
--- PASS: TestIsLogformat (0.00s)
    --- PASS: TestIsLogformat/invalid_log_format (0.00s)
    --- PASS: TestIsLogformat/no_$_sign (0.00s)
    --- PASS: TestIsLogformat/nonexist_required_log_format (0.00s)
    --- PASS: TestIsLogformat/valid_log_format (0.00s)
=== RUN   TestIsToken
=== RUN   TestIsToken/invalid_token
[�[31mERR�[0m] Error! Only validates token; please check your config file
[�[34mINF�[0m] Use "-h" flag for more info about command.
=== RUN   TestIsToken/valid_slack_token
=== RUN   TestIsToken/valid_telegram_token
--- PASS: TestIsToken (0.00s)
    --- PASS: TestIsToken/invalid_token (0.00s)
    --- PASS: TestIsToken/valid_slack_token (0.00s)
    --- PASS: TestIsToken/valid_telegram_token (0.00s)
=== RUN   TestIsHexcolor
=== RUN   TestIsHexcolor/invalid_hex_color
[�[31mERR�[0m] Error! Only validates hex color; please check your config file
[�[34mINF�[0m] Use "-h" flag for more info about command.
=== RUN   TestIsHexcolor/invalid_hex_syntax
[�[31mERR�[0m] Error! Only validates hex color; please check your config file
[�[34mINF�[0m] Use "-h" flag for more info about command.
=== RUN   TestIsHexcolor/valid_hex_color
--- PASS: TestIsHexcolor (0.00s)
    --- PASS: TestIsHexcolor/invalid_hex_color (0.00s)
    --- PASS: TestIsHexcolor/invalid_hex_syntax (0.00s)
    --- PASS: TestIsHexcolor/valid_hex_color (0.00s)
=== RUN   TestIsParseMode
=== RUN   TestIsParseMode/invalid_parse_mode
[�[31mERR�[0m] Error! Only validates parse mode [Markdown(v2), or HTML]; please check your config file
[�[34mINF�[0m] Use "-h" flag for more info about command.
=== RUN   TestIsParseMode/outdated_markdown
[�[31mERR�[0m] Error! Only validates parse mode [Markdown(v2), or HTML]; please check your config file
[�[34mINF�[0m] Use "-h" flag for more info about command.
=== RUN   TestIsParseMode/case_sensitive_invalid_html
[�[31mERR�[0m] Error! Only validates parse mode [Markdown(v2), or HTML]; please check your config file
[�[34mINF�[0m] Use "-h" flag for more info about command.
=== RUN   TestIsParseMode/valid_markdown
=== RUN   TestIsParseMode/valid_html
--- PASS: TestIsParseMode (0.00s)
    --- PASS: TestIsParseMode/invalid_parse_mode (0.00s)
    --- PASS: TestIsParseMode/outdated_markdown (0.00s)
    --- PASS: TestIsParseMode/case_sensitive_invalid_html (0.00s)
    --- PASS: TestIsParseMode/valid_markdown (0.00s)
    --- PASS: TestIsParseMode/valid_html (0.00s)
=== RUN   TestIsChannel
=== RUN   TestIsChannel/invalid_channel_format
[�[31mERR�[0m] Error! Only validates Slack channel; please check your config file
[�[34mINF�[0m] Use "-h" flag for more info about command.
=== RUN   TestIsChannel/invalid_lowercase_channel_name
[�[31mERR�[0m] Error! Only validates Slack channel; please check your config file
[�[34mINF�[0m] Use "-h" flag for more info about command.
=== RUN   TestIsChannel/valid_channel_format
--- PASS: TestIsChannel (0.00s)
    --- PASS: TestIsChannel/invalid_channel_format (0.00s)
    --- PASS: TestIsChannel/invalid_lowercase_channel_name (0.00s)
    --- PASS: TestIsChannel/valid_channel_format (0.00s)
=== RUN   TestIsChatID
=== RUN   TestIsChatID/invalid_chat_id
[�[31mERR�[0m] Error! Only validates chat_id; please check your config file
[�[34mINF�[0m] Use "-h" flag for more info about command.
=== RUN   TestIsChatID/digit_chat_id
--- PASS: TestIsChatID (0.00s)
    --- PASS: TestIsChatID/invalid_chat_id (0.00s)
    --- PASS: TestIsChatID/digit_chat_id (0.00s)
PASS
coverage: 100.0% of statements
ok  	ktbs.dev/teler/pkg/matchers	1.052s	coverage: 100.0% of statements

Closing issues

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • I have followed the guidelines in our CONTRIBUTING.md document.
  • I have written new tests for my changes.
    • My changes successfully ran and pass tests locally.

@kitabisa-bot
Copy link

kitabisa-bot bot commented Oct 27, 2020

Please consider taking a moment for us to review this pull request.

review needed

@fairyhunter13
Copy link
Contributor Author

@dwisiswant0 Could you please check my code?

Copy link
Collaborator

@dwisiswant0 dwisiswant0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @fairyhunter13, I confirm to request changes & some revisions for tests you are working on.

Please note that the closing issue that you mention is for the whole part of the test, considering this PR is only partially done, I suggest to change this summary TO NOT use closing keywords - but you can still link to issue #32 to track the progress of that issue ticket.

pkg/errors/errors.go Outdated Show resolved Hide resolved
pkg/errors/errors.go Outdated Show resolved Hide resolved
pkg/matchers/config_test.go Outdated Show resolved Hide resolved
pkg/matchers/config_test.go Outdated Show resolved Hide resolved
pkg/matchers/config_test.go Outdated Show resolved Hide resolved
pkg/matchers/config_test.go Outdated Show resolved Hide resolved
pkg/matchers/config_test.go Outdated Show resolved Hide resolved
pkg/matchers/config_test.go Outdated Show resolved Hide resolved
pkg/matchers/config_test.go Outdated Show resolved Hide resolved
pkg/matchers/config_test.go Outdated Show resolved Hide resolved
@dwisiswant0 dwisiswant0 added Status: Revision Needed A round of revision is needed before this work may be published and removed Status: Review Needed labels Oct 27, 2020
@kitabisa-bot
Copy link

kitabisa-bot bot commented Oct 27, 2020

We thank reviewers for the constructive comments on this pull request.
Where appropriate, we believe the additional analyses discussed and/or suggested above have helped us to substantially improve to teler development.

revision needed

@kitabisa-bot
Copy link

kitabisa-bot bot commented Oct 27, 2020

Please consider taking a moment for us to review this pull request.

review needed

@fairyhunter13
Copy link
Contributor Author

@dwisiswant0 Could you please check my PR again?

@dwisiswant0
Copy link
Collaborator

This looks lit @fairyhunter13. Mad thanks for your contributions & of course for your efforts, merging soon. 🔥
@all-contributors please add @fairyhunter13 for test.

@allcontributors
Copy link
Contributor

@dwisiswant0

I've put up a pull request to add @fairyhunter13! 🎉

@fairyhunter13
Copy link
Contributor Author

@dwisiswant0 Sorry for my inexperience in contributing to the open-source project. Thank you for your reviews and hard work. Please keep it up! 👍 👍 👍

@dwisiswant0 dwisiswant0 removed the Status: Revision Needed A round of revision is needed before this work may be published label Oct 27, 2020
@dwisiswant0 dwisiswant0 merged commit b714ab7 into teler-sh:master Oct 27, 2020
@fairyhunter13 fairyhunter13 deleted the enhancement/add_unit_tests branch October 27, 2020 09:45
@dwisiswant0 dwisiswant0 added this to the Unit Tests milestone Oct 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants