-
Notifications
You must be signed in to change notification settings - Fork 55
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
New: regexp in query matching #132
Conversation
README-ru.md
Outdated
@@ -772,6 +772,25 @@ runner.RunWithTesting(t, &runner.RunWithTestingParams{ | |||
... | |||
``` | |||
|
|||
###### queryMatchesRegexp | |||
|
|||
Расширяет `queryMatches` так, чтобы можно было испозовать проверку по регулярному выражению. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
опечатка "использовать"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поправил
Расширяет `queryMatches` так, чтобы можно было испозовать проверку по регулярному выражению. | ||
|
||
Параметры: | ||
- `expectedQuery` (обязательный) - строка параметров с которой будет сверяться запрос. Порядок параметров не имеет значения. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а есть какая-то причина почему эту функциональность нельзя сделать в queryMatches? Не думаю что кто-то использовал $matchRegexp в своих тестах
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а есть какая-то причина почему эту функциональность нельзя сделать в queryMatches? Не думаю что кто-то использовал $matchRegexp в своих тестах
Вынес в отдельный contraint для того, чтобы не было шанса сломать существующие тесты из-за использования новой функции Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тесты не должны сломаться, так как это лишь внутренняя реализация verify.
Старый verify просто делает deepEq после сортировки(regExp там не было).
Так что будет только расширение функционала.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ну вот надо бы как-нибудь убедиться в том, что точно ничего не сломается. Возможно, стоит подумать над дополнительными тестами здесь, посмотреть какие проверки делаются в реальных проектах. Есть стойкое ощущение, что мог что-то не учесть
🚀 PR was released in |
Добавлен новый тип requestConstraints для моков - queryMatchesRegexp
Для сравнения по regexp написана функция для сравнения значений query параметров, используемая только в queryMatchesRegexp
Для новых фич написаны тесты, дополнена документация