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

[FIX] the hostname of enpoint parser should parse dash symbol. #13

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class EndpointParser: ConnctionStringParser {
One(.word.subtracting(.anyOf(":?=&")))
}
Optionally {
One(".")
One(.anyOf(".-_"))
}
}
Anchor.wordBoundary
Expand Down
10 changes: 10 additions & 0 deletions Tests/EventStoreDBTests/ConnectionStringParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ final class ConnectionStringParserTests: XCTestCase {
XCTAssertEqual(endpoints?.count, 1)
XCTAssertEqual(endpoints?[0].host, "localhost")
}

func test_host_should_be_parsed_host_contains_dash_succeed() throws {
let connectionString = "esdb://eventstore-service:2113?tls=false"

let parser = EndpointParser()
let endpoints = try parser.parse(connectionString)

XCTAssertEqual(endpoints?.count, 1)
XCTAssertEqual(endpoints?[0].host, "eventstore-service")
}

func test_host_should_be_parsed_ip_succeed() throws {
let connectionString = "esdb://192.168.41.32:2113?tls=false"
Expand Down
Loading