Skip to content

Commit

Permalink
Rename type to group.
Browse files Browse the repository at this point in the history
  • Loading branch information
ychescale9 committed Dec 27, 2023
1 parent ad4d941 commit 0643d03
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.reactivecircus.kstreamlined.backend.client

import io.github.reactivecircus.kstreamlined.backend.schema.generated.types.KotlinWeeklyIssueEntry
import io.github.reactivecircus.kstreamlined.backend.schema.generated.types.KotlinWeeklyIssueEntryType
import io.github.reactivecircus.kstreamlined.backend.schema.generated.types.KotlinWeeklyIssueEntryGroup
import io.ktor.client.HttpClient
import io.ktor.client.engine.HttpClientEngine
import io.ktor.client.plugins.HttpTimeout
Expand Down Expand Up @@ -36,10 +36,10 @@ class RealKotlinWeeklyIssueClient(
withAttribute = "style" to "overflow: hidden;"
findAll {
forEach { section ->
val type = section.div {
val group = section.div {
findFirst { text }
}.uppercase().let {
KotlinWeeklyIssueEntryType.entries.find { type -> it == type.name } ?: return@forEach
KotlinWeeklyIssueEntryGroup.entries.find { type -> it == type.name } ?: return@forEach
}

val titleWithLinkPairs = mutableListOf<Pair<String, String>>()
Expand Down Expand Up @@ -75,7 +75,7 @@ class RealKotlinWeeklyIssueClient(
titleWithLinkPairs.forEachIndexed { index, pair ->
add(
KotlinWeeklyIssueEntry(
type = type,
group = group,
title = pair.first,
url = pair.second,
summary = summaries[index],
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/schema/kstreamlined.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ type KotlinWeeklyIssueEntry {
url: String!
"Url of the issue entry source."
source: String!
"Type of the issue entry."
type: KotlinWeeklyIssueEntryType!
"Group of the issue entry."
group: KotlinWeeklyIssueEntryGroup!
}

enum KotlinWeeklyIssueEntryType {
enum KotlinWeeklyIssueEntryGroup {
"Announcements."
ANNOUNCEMENTS
"Articles."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.reactivecircus.kstreamlined.backend.client

import io.github.reactivecircus.kstreamlined.backend.schema.generated.types.KotlinWeeklyIssueEntry
import io.github.reactivecircus.kstreamlined.backend.schema.generated.types.KotlinWeeklyIssueEntryType
import io.github.reactivecircus.kstreamlined.backend.schema.generated.types.KotlinWeeklyIssueEntryGroup

object FakeKotlinWeeklyIssueClient : KotlinWeeklyIssueClient {

Expand All @@ -20,34 +20,34 @@ val DummyKotlinWeeklyIssueEntries = listOf(
summary = "Last month JetBrains introduced Amper, a tool to improve the project configuration user experience. Marton Braun gives us an update about its state in December 2023.",
url = "https://blog.jetbrains.com/amper/2023/12/amper-update-december-2023/",
source = "blog.jetbrains.com",
type = KotlinWeeklyIssueEntryType.ANNOUNCEMENTS,
group = KotlinWeeklyIssueEntryGroup.ANNOUNCEMENTS,
),
KotlinWeeklyIssueEntry(
title = "How to Use the Cucumber Framework to Test Application Use Cases",
summary = "Matthias Schenk writes today about Cucumber, a framework that can be used in application development to verify the correct behavior of the application.",
url = "https://towardsdev.com/how-to-use-the-cucumber-framework-to-test-application-use-cases-48b4f21ee0d0",
source = "towardsdev.com",
type = KotlinWeeklyIssueEntryType.ARTICLES,
group = KotlinWeeklyIssueEntryGroup.ARTICLES,
),
KotlinWeeklyIssueEntry(
title = "Using launcher and themed icons in Android Studio, the manual way",
summary = "Marlon Lòpez describes how we can use the launcher and the themed icons in Android Studio.",
url = "https://dev.to/marlonlom/using-launcher-and-themed-icons-in-android-studio-the-manual-way-1h2a",
source = "dev.to",
type = KotlinWeeklyIssueEntryType.ANDROID,
group = KotlinWeeklyIssueEntryGroup.ANDROID,
),
KotlinWeeklyIssueEntry(
title = "Setting Sail with Compose Multiplatform by Isuru Rajapakse",
summary = "Isuru Rajapakse talks at the DevFest Sri Lanka about Compose Multiplatform.",
url = "https://www.youtube.com/watch?v=sG60644C47I",
source = "www.youtube.com",
type = KotlinWeeklyIssueEntryType.VIDEOS,
group = KotlinWeeklyIssueEntryGroup.VIDEOS,
),
KotlinWeeklyIssueEntry(
title = "Kim - Kotlin Image Metadata",
summary = "Kim is a Kotlin image metadata manipulation library for Kotlin Multiplatform.",
url = "https://github.com/Ashampoo/kim",
source = "github.com",
type = KotlinWeeklyIssueEntryType.LIBRARIES,
group = KotlinWeeklyIssueEntryGroup.LIBRARIES,
),
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.reactivecircus.kstreamlined.backend.client

import io.github.reactivecircus.kstreamlined.backend.schema.generated.types.KotlinWeeklyIssueEntry
import io.github.reactivecircus.kstreamlined.backend.schema.generated.types.KotlinWeeklyIssueEntryType
import io.github.reactivecircus.kstreamlined.backend.schema.generated.types.KotlinWeeklyIssueEntryGroup
import io.ktor.client.engine.mock.MockEngine
import io.ktor.client.engine.mock.respond
import io.ktor.client.engine.mock.respondError
Expand Down Expand Up @@ -31,84 +31,84 @@ class RealKotlinWeeklyIssueClientTest {
summary = "Last month JetBrains introduced Amper, a tool to improve the project configuration user experience. Marton Braun gives us an update about its state in December 2023.",
url = "https://blog.jetbrains.com/amper/2023/12/amper-update-december-2023/",
source = "blog.jetbrains.com",
type = KotlinWeeklyIssueEntryType.ANNOUNCEMENTS,
group = KotlinWeeklyIssueEntryGroup.ANNOUNCEMENTS,
),
KotlinWeeklyIssueEntry(
title = "Koin Wrapped- Recapping the 2023 Milestones of Our Kotlin Integration Framework",
summary = "In this post, the Koin crew wraps up all the milestones and roadmap achieved in 2023.",
url = "https://blog.cloud-inject.io/koin-2023-highlights",
source = "blog.cloud-inject.io",
type = KotlinWeeklyIssueEntryType.ANNOUNCEMENTS,
group = KotlinWeeklyIssueEntryGroup.ANNOUNCEMENTS,
),
KotlinWeeklyIssueEntry(
title = "How to Use the Cucumber Framework to Test Application Use Cases",
summary = "Matthias Schenk writes today about Cucumber, a framework that can be used in application development to verify the correct behavior of the application.",
url = "https://towardsdev.com/how-to-use-the-cucumber-framework-to-test-application-use-cases-48b4f21ee0d0",
source = "towardsdev.com",
type = KotlinWeeklyIssueEntryType.ARTICLES,
group = KotlinWeeklyIssueEntryGroup.ARTICLES,
),
KotlinWeeklyIssueEntry(
title = "Jetpack Preferences DataStore in Kotlin Multiplatform (KMP)",
summary = "FunkyMuse put up an article showcasing how to read and write preferences on multiple platforms when using the KMP DataStore library.",
url = "https://funkymuse.dev/posts/create-data-store-kmp/",
source = "funkymuse.dev",
type = KotlinWeeklyIssueEntryType.ARTICLES,
group = KotlinWeeklyIssueEntryGroup.ARTICLES,
),
KotlinWeeklyIssueEntry(
title = "Using launcher and themed icons in Android Studio, the manual way",
summary = "Marlon Lòpez describes how we can use the launcher and the themed icons in Android Studio.",
url = "https://dev.to/marlonlom/using-launcher-and-themed-icons-in-android-studio-the-manual-way-1h2a",
source = "dev.to",
type = KotlinWeeklyIssueEntryType.ANDROID,
group = KotlinWeeklyIssueEntryGroup.ANDROID,
),
KotlinWeeklyIssueEntry(
title = "Setting Sail with Compose Multiplatform by Isuru Rajapakse",
summary = "Isuru Rajapakse talks at the DevFest Sri Lanka about Compose Multiplatform.",
url = "https://www.youtube.com/watch?v=sG60644C47I",
source = "www.youtube.com",
type = KotlinWeeklyIssueEntryType.VIDEOS,
group = KotlinWeeklyIssueEntryGroup.VIDEOS,
),
KotlinWeeklyIssueEntry(
title = "Developer Experience and Kotlin Lenses",
summary = "In his next video, Duncan McGregor keeps talking about Developer Experience and Kotlin lenses.",
url = "https://www.youtube.com/watch?v=htvpwOKYhNs",
source = "www.youtube.com",
type = KotlinWeeklyIssueEntryType.VIDEOS,
group = KotlinWeeklyIssueEntryGroup.VIDEOS,
),
KotlinWeeklyIssueEntry(
title = "Network-Resilient Applications with Store5 | Talking Kotlin",
summary = "In this chapter of Talking Kotlin, Mike Nakhimovich, Yigit Boyar, and Matthew Ramotar talk about Store, a Kotlin Multiplatform library for building network-resilient applications.",
url = "https://www.youtube.com/watch?v=a32Otwx7c0w",
source = "www.youtube.com",
type = KotlinWeeklyIssueEntryType.VIDEOS,
group = KotlinWeeklyIssueEntryGroup.VIDEOS,
),
KotlinWeeklyIssueEntry(
title = "Kim - Kotlin Image Metadata",
summary = "Kim is a Kotlin image metadata manipulation library for Kotlin Multiplatform.",
url = "https://github.com/Ashampoo/kim",
source = "github.com",
type = KotlinWeeklyIssueEntryType.LIBRARIES,
group = KotlinWeeklyIssueEntryGroup.LIBRARIES,
),
KotlinWeeklyIssueEntry(
title = "DiKTat",
summary = "DiKTat is a strict coding standard for Kotlin, consisting of a collection of Kotlin code style rules implemented as Abstract Syntax Tree (AST) visitors built on top of KTlint.",
url = "https://github.com/saveourtool/diktat",
source = "github.com",
type = KotlinWeeklyIssueEntryType.LIBRARIES,
group = KotlinWeeklyIssueEntryGroup.LIBRARIES,
),
KotlinWeeklyIssueEntry(
title = "FailGood",
summary = "Failgood is a test runner for Kotlin focusing on simplicity, usability and speed.",
url = "https://github.com/failgood/failgood",
source = "github.com",
type = KotlinWeeklyIssueEntryType.LIBRARIES,
group = KotlinWeeklyIssueEntryGroup.LIBRARIES,
),
KotlinWeeklyIssueEntry(
title = "exif-viewer",
summary = "Free online EXIF Viewer built with Kotlin/WASM.",
url = "https://github.com/StefanOltmann/exif-viewer",
source = "github.com",
type = KotlinWeeklyIssueEntryType.LIBRARIES,
group = KotlinWeeklyIssueEntryGroup.LIBRARIES,
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class KotlinWeeklyIssueDataFetcherTest {
summary
url
source
type
group
}
}
""".trimIndent()
Expand All @@ -52,30 +52,30 @@ class KotlinWeeklyIssueDataFetcherTest {
assertEquals(DummyKotlinWeeklyIssueEntries[0].summary, context.read("data.kotlinWeeklyIssue[0].summary"))
assertEquals(DummyKotlinWeeklyIssueEntries[0].url, context.read("data.kotlinWeeklyIssue[0].url"))
assertEquals(DummyKotlinWeeklyIssueEntries[0].source, context.read("data.kotlinWeeklyIssue[0].source"))
assertEquals(DummyKotlinWeeklyIssueEntries[0].type.name, context.read("data.kotlinWeeklyIssue[0].type"))
assertEquals(DummyKotlinWeeklyIssueEntries[0].group.name, context.read("data.kotlinWeeklyIssue[0].group"))

assertEquals(DummyKotlinWeeklyIssueEntries[1].title, context.read("data.kotlinWeeklyIssue[1].title"))
assertEquals(DummyKotlinWeeklyIssueEntries[1].summary, context.read("data.kotlinWeeklyIssue[1].summary"))
assertEquals(DummyKotlinWeeklyIssueEntries[1].url, context.read("data.kotlinWeeklyIssue[1].url"))
assertEquals(DummyKotlinWeeklyIssueEntries[1].source, context.read("data.kotlinWeeklyIssue[1].source"))
assertEquals(DummyKotlinWeeklyIssueEntries[1].type.name, context.read("data.kotlinWeeklyIssue[1].type"))
assertEquals(DummyKotlinWeeklyIssueEntries[1].group.name, context.read("data.kotlinWeeklyIssue[1].group"))

assertEquals(DummyKotlinWeeklyIssueEntries[2].title, context.read("data.kotlinWeeklyIssue[2].title"))
assertEquals(DummyKotlinWeeklyIssueEntries[2].summary, context.read("data.kotlinWeeklyIssue[2].summary"))
assertEquals(DummyKotlinWeeklyIssueEntries[2].url, context.read("data.kotlinWeeklyIssue[2].url"))
assertEquals(DummyKotlinWeeklyIssueEntries[2].source, context.read("data.kotlinWeeklyIssue[2].source"))
assertEquals(DummyKotlinWeeklyIssueEntries[2].type.name, context.read("data.kotlinWeeklyIssue[2].type"))
assertEquals(DummyKotlinWeeklyIssueEntries[2].group.name, context.read("data.kotlinWeeklyIssue[2].group"))

assertEquals(DummyKotlinWeeklyIssueEntries[3].title, context.read("data.kotlinWeeklyIssue[3].title"))
assertEquals(DummyKotlinWeeklyIssueEntries[3].summary, context.read("data.kotlinWeeklyIssue[3].summary"))
assertEquals(DummyKotlinWeeklyIssueEntries[3].url, context.read("data.kotlinWeeklyIssue[3].url"))
assertEquals(DummyKotlinWeeklyIssueEntries[3].source, context.read("data.kotlinWeeklyIssue[3].source"))
assertEquals(DummyKotlinWeeklyIssueEntries[3].type.name, context.read("data.kotlinWeeklyIssue[3].type"))
assertEquals(DummyKotlinWeeklyIssueEntries[3].group.name, context.read("data.kotlinWeeklyIssue[3].group"))

assertEquals(DummyKotlinWeeklyIssueEntries[4].title, context.read("data.kotlinWeeklyIssue[4].title"))
assertEquals(DummyKotlinWeeklyIssueEntries[4].summary, context.read("data.kotlinWeeklyIssue[4].summary"))
assertEquals(DummyKotlinWeeklyIssueEntries[4].url, context.read("data.kotlinWeeklyIssue[4].url"))
assertEquals(DummyKotlinWeeklyIssueEntries[4].source, context.read("data.kotlinWeeklyIssue[4].source"))
assertEquals(DummyKotlinWeeklyIssueEntries[4].type.name, context.read("data.kotlinWeeklyIssue[4].type"))
assertEquals(DummyKotlinWeeklyIssueEntries[4].group.name, context.read("data.kotlinWeeklyIssue[4].group"))
}
}

0 comments on commit 0643d03

Please sign in to comment.