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

#234 | Better URL validation | Iframe board tests added (plus some refactor) #242

Merged
merged 7 commits into from
Jan 24, 2020

Conversation

szymon-owczarzak
Copy link
Contributor

@szymon-owczarzak szymon-owczarzak commented Jan 24, 2020

Description

URL validation changed so we can use port numbers.
More Code refactoring and Iframe boards tests.

Types of changes

  • Bugfix
  • Code refactor
  • Detekt issue fixes
  • New Tests Added

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • Automated functional tests have been added or modified to cover my changes (if applicable)
  • I have updated the documentation accordingly.

I hereby agree to the terms of the Cogboard Contributor License Agreement.

@szymon-owczarzak szymon-owczarzak added the maintenance documentation, refactoring, releasing etc... label Jan 24, 2020
@szymon-owczarzak szymon-owczarzak self-assigned this Jan 24, 2020
@szymon-owczarzak szymon-owczarzak changed the title Cypress tests more object oriented IFrame Board basic tests added (plus some refactor) Jan 24, 2020
@@ -31,7 +31,7 @@
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [ ] My code follows the [code style](/CONTRIBUTING.md#coding-conventions) of this project.
- [ ] My code follows the [code style](https://github.com/Cognifide/cogboard/blob/master/CONTRIBUTING.md#coding-conventions) of this project.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This link did not worked

@szymon-owczarzak szymon-owczarzak changed the title IFrame Board basic tests added (plus some refactor) #234 | Better URL validation | Iframe board tests added (plus some refactor) Jan 24, 2020
Comment on lines +8 to +17
fun create(
address: String,
vertx: Vertx,
configuration: Map<String, (JsonObject) -> String>
): MessageConsumer<JsonObject> = vertx.eventBus()
.consumer<JsonObject>(address)
.handler {
val body = it.body()
configuration[body.getString("method")]?.let { method ->
it.reply(method(body.getJsonObject("payload")))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Detekt fix

Comment on lines +15 to +25
return if (this.isEmpty()) {
-1
} else {
Random.nextInt(0, this.size)
val indexes = this.mapIndexed { index, _ -> index }
.filter { i -> !usedIndexes.contains(i) }
when {
// If there is one index, there is no need to use random function
indexes.size == 1 -> return indexes[0]
indexes.isNotEmpty() -> indexes[Random.nextInt(0, indexes.size)]
else -> Random.nextInt(0, this.size)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Detekt fix

Comment on lines +63 to +66
.filter {
it.getString(version.getMetricKey()) != "alert_status" &&
it.getString(version.getMetricKey()) == metricName
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Detekt fix

Comment on lines +18 to +20
fun getVersion(version: String) =
if (version == "5.x") V5x()
else V7x()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Detekt fix

Comment on lines +79 to +83
validator: () =>
string().matches(
/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/,
{ message: vm.INVALID_URL(), excludeEmptyString: true }
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Better URL Validation - port number possible

Comment on lines +217 to +221
validator: () =>
string().matches(
/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/,
{ message: vm.INVALID_URL(), excludeEmptyString: true }
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Better URL Validation - port number possible

Comment on lines +227 to +231
validator: () =>
string().matches(
/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/,
{ message: vm.INVALID_URL(), excludeEmptyString: true }
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Better URL Validation - port number possible

Comment on lines +25 to +33
it('Logged user can add new iframe dashboard', () => {
addIframeDashboard();
});

it('Logged user can choose iframe dashboard', () => {
addIframeDashboard()
.canBeSelected()
.assertIframeExists();
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added tests for Iframe widget

@szymon-owczarzak szymon-owczarzak merged commit 564c238 into master Jan 24, 2020
@szymon-owczarzak szymon-owczarzak deleted the cypress-tests-more-object-oriented branch January 24, 2020 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance documentation, refactoring, releasing etc...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant