Fix hashtag

This commit is contained in:
Ryan Harg 2024-04-02 09:16:12 +02:00
parent 04805f3a57
commit 5306a40503
3 changed files with 23 additions and 2 deletions

View file

@ -16,7 +16,10 @@ data class GithubRepo(
name = repoPath.substring(usernameEnd + 1).trimEnd { ch -> ch == '/' }
}
@Transient val capitalizedName = name.replaceFirstChar { it.uppercase() }
@Transient val capitalizedName =
name
.split("-", "_", ".", ";", "+")
.joinToString("") { part -> part.replaceFirstChar { it.uppercase() } }
val url = urlPrefix + repoPath

View file

@ -29,7 +29,7 @@ class Publisher(
if (!dryRun) {
request.execute()
} else {
log("Dry-Run, skipping publishing of events...")
log("Dry-Run, skipping publishing of event...")
}
return@mapNotNull release
} catch (ex: BigBoneRequestException) {

View file

@ -0,0 +1,18 @@
package de.rpr.githubreleases.model
import assertk.assertThat
import assertk.assertions.isEqualTo
import io.kotest.core.spec.style.DescribeSpec
class GithubRepoTest : DescribeSpec({
describe("GithubRepo") {
it("capitalizedName should be correct") {
assertThat(GithubRepo("test/test-one").capitalizedName).isEqualTo("TestOne")
assertThat(GithubRepo("test/test.one").capitalizedName).isEqualTo("TestOne")
assertThat(GithubRepo("test/test+one").capitalizedName).isEqualTo("TestOne")
assertThat(GithubRepo("test/test;one").capitalizedName).isEqualTo("TestOne")
}
}
})