-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge workshop into a single session. Fix #259
- Loading branch information
Showing
10 changed files
with
179 additions
and
34 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import io.ktor.client.call.body | ||
import io.ktor.client.plugins.HttpRequestRetry | ||
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation | ||
import io.ktor.client.request.get | ||
import io.ktor.serialization.kotlinx.json.json | ||
import io.ktor.server.config.ApplicationConfig | ||
import io.ktor.server.testing.TestApplication | ||
import kotlinx.coroutines.test.runTest | ||
import org.jetbrains.kotlinconf.Conference | ||
import org.junit.jupiter.api.Assertions.assertFalse | ||
import org.junit.jupiter.api.Test | ||
|
||
|
||
class ApiTest { | ||
|
||
val app = TestApplication { | ||
environment { | ||
config = ApplicationConfig("test-application.yaml") | ||
} | ||
} | ||
|
||
val client = app.createClient { | ||
install(HttpRequestRetry) { | ||
} | ||
install(ContentNegotiation) { | ||
json() | ||
} | ||
} | ||
|
||
@Test | ||
fun testWorkshopPartsAreMerged() = runTest { | ||
val conference = client.get("/conference").body<Conference>() | ||
val workshops = conference.sessions.filter { it.tags?.contains("Workshop") == true } | ||
|
||
for (workshop in workshops) { | ||
assertFalse("Part" in workshop.title) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import org.jetbrains.kotlinconf.backend.dropAfter | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Test | ||
|
||
class StringExtTest { | ||
|
||
@Test | ||
fun `dropAfter should drop everything after the chunk`() { | ||
val input = "This is a test string. Part 1" | ||
val chunk = ". Part" | ||
val expected = "This is a test string" | ||
assertEquals(expected, input.dropAfter(chunk)) | ||
} | ||
|
||
@Test | ||
fun `dropAfter should return the original string if the chunk is not found`() { | ||
val input = "This is a test string" | ||
val chunk = ". Part" | ||
assertEquals(input, input.dropAfter(chunk)) | ||
} | ||
|
||
@Test | ||
fun `dropAfter should handle empty string`() { | ||
val input = "" | ||
val chunk = ". Part" | ||
assertEquals("", input.dropAfter(chunk)) | ||
} | ||
|
||
@Test | ||
fun `dropAfter should handle empty chunk`() { | ||
val input = "This is a test string" | ||
val chunk = "" | ||
assertEquals("", input.dropAfter(chunk)) | ||
} | ||
|
||
@Test | ||
fun `dropAfter should handle chunk at the beginning`() { | ||
val input = ". Part 1 This is a test string" | ||
val chunk = ". Part" | ||
val expected = "" | ||
assertEquals(expected, input.dropAfter(chunk)) | ||
} | ||
|
||
@Test | ||
fun `dropAfter should handle chunk at the end`() { | ||
val input = "This is a test string. Part" | ||
val chunk = ". Part" | ||
val expected = "This is a test string" | ||
assertEquals(expected, input.dropAfter(chunk)) | ||
} | ||
|
||
@Test | ||
fun `dropAfter should handle multiple occurrences of the chunk`() { | ||
val input = "This is a test string. Part 1. Part 2" | ||
val chunk = ". Part" | ||
val expected = "This is a test string" | ||
assertEquals(expected, input.dropAfter(chunk)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
ktor: | ||
deployment: | ||
port: 8080 | ||
|
||
application: | ||
modules: | ||
- org.jetbrains.kotlinconf.backend.MainKt.conferenceBackend | ||
|
||
|
||
sessionize: | ||
url: "https://sessionize.com/api/v2/cdftbl11/view/All" | ||
imagesUrl: "https://sessionize.com/image/" | ||
interval: 60 | ||
|
||
database: | ||
host: "$DB0_HOST:" | ||
user: "$DB0_USERNAME:" | ||
password: "$DB0_PASSWORD:" | ||
database: "$DB0_NAME:" | ||
|
||
poolSize: 5 | ||
|
||
service: | ||
environment: test | ||
secret: "$ADMIN_SECRET:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2761,6 +2761,11 @@ wrappy@1: | |
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" | ||
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== | ||
|
||
[email protected]: | ||
version "8.18.0" | ||
resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" | ||
integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== | ||
|
||
[email protected]: | ||
version "8.5.0" | ||
resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters