Skip to content

Commit

Permalink
Add issueNumber to KotlinWeekly entry.
Browse files Browse the repository at this point in the history
  • Loading branch information
ychescale9 committed Dec 27, 2023
1 parent afdc1be commit ad4d941
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ fun KotlinWeeklyItem.toKotlinWeeklyEntry(): KotlinWeekly {
.parse(pubDate, DateTimeFormatter.RFC_1123_DATE_TIME)
.toInstant(),
contentUrl = link,
issueNumber = title.substringAfter("#").toInt(),
)
}
2 changes: 2 additions & 0 deletions src/main/resources/schema/kstreamlined.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ type KotlinWeekly implements FeedEntry {
publishTime: Instant!
"Url of the content."
contentUrl: String!
"Issue number."
issueNumber: Int!
}

type KotlinWeeklyIssueEntry {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class FeedEntryDataFetcherTest {
}
... on KotlinWeekly {
__typename
issueNumber
}
}
}
Expand Down Expand Up @@ -85,6 +86,7 @@ class FeedEntryDataFetcherTest {
assertEquals(dummyKotlinWeeklyEntry.title, context.read("data.feedEntries[0].title"))
assertEquals(dummyKotlinWeeklyEntry.publishTime, context.read<String>("data.feedEntries[0].publishTime").toInstant())
assertEquals(dummyKotlinWeeklyEntry.contentUrl, context.read("data.feedEntries[0].contentUrl"))
assertEquals(dummyKotlinWeeklyEntry.issueNumber, context.read("data.feedEntries[0].issueNumber"))

val dummyKotlinBlogEntry = DummyKotlinBlogItem.toKotlinBlogEntry()
assertEquals(dummyKotlinBlogEntry.id, context.read("data.feedEntries[1].id"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class KotlinWeeklyEntryMapperTest {
title = "Kotlin Weekly #381",
publishTime = Instant.parse("2023-11-19T09:13:00Z"),
contentUrl = "https://mailchi.mp/kotlinweekly/kotlin-weekly-381",
issueNumber = 381,
)
val actual = KotlinWeeklyItem(
title = "Kotlin Weekly #381",
Expand Down

0 comments on commit ad4d941

Please sign in to comment.