Skip to content

Commit

Permalink
Fix tests and typing
Browse files Browse the repository at this point in the history
  • Loading branch information
ekrojo77 committed Oct 23, 2024
1 parent 6ab1b31 commit 02a390f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ trait ConverterService {
): api.TagsSearchResult = {
api.TagsSearchResult(tagsCount, offset, pageSize, language, tags)
}

private def toApiArticleIntroSummary(introSummary: ArticleIntroSummary): api.ArticleIntroSummary = {
api.ArticleIntroSummary(
introSummary.content,
Expand Down
24 changes: 16 additions & 8 deletions article-api/src/test/scala/no/ndla/articleapi/TestData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ trait TestData {
availability = Availability.everyone.toString,
relatedContent = Seq.empty,
revisionDate = None,
slug = None
slug = None,
summary = None
)

val apiArticleV2: api.ArticleV2 = api.ArticleV2(
Expand Down Expand Up @@ -122,7 +123,8 @@ trait TestData {
availability = Availability.everyone.toString,
relatedContent = Seq.empty,
revisionDate = None,
slug = None
slug = None,
summary = None
)

val sampleArticleWithPublicDomain: Article = Article(
Expand Down Expand Up @@ -152,7 +154,8 @@ trait TestData {
availability = Availability.everyone,
relatedContent = Seq.empty,
revisionDate = Some(NDLADate.now().withNano(0)),
slug = None
slug = None,
summary = Seq.empty
)

val sampleDomainArticle: Article = Article(
Expand All @@ -177,7 +180,8 @@ trait TestData {
availability = Availability.everyone,
relatedContent = Seq.empty,
revisionDate = None,
slug = None
slug = None,
summary = Seq.empty
)

val sampleDomainArticle2: Article = Article(
Expand All @@ -202,7 +206,8 @@ trait TestData {
availability = Availability.everyone,
relatedContent = Seq.empty,
revisionDate = None,
slug = None
slug = None,
summary = Seq(ArticleIntroSummary("summary", "en"))
)

val sampleArticleWithByNcSa: Article = sampleArticleWithPublicDomain.copy(copyright = byNcSaCopyright)
Expand Down Expand Up @@ -239,7 +244,8 @@ trait TestData {
availability = Availability.everyone,
relatedContent = Seq.empty,
revisionDate = None,
slug = None
slug = None,
summary = Seq(ArticleIntroSummary("summary", "en"))
)

val apiArticleWithHtmlFaultV2: api.ArticleV2 = api.ArticleV2(
Expand Down Expand Up @@ -273,7 +279,8 @@ trait TestData {
availability = Availability.everyone.toString,
relatedContent = Seq.empty,
revisionDate = None,
slug = None
slug = None,
summary = None
)

val (nodeId, nodeId2) = ("1234", "4321")
Expand Down Expand Up @@ -307,7 +314,8 @@ trait TestData {
availability = Availability.everyone,
relatedContent = Seq.empty,
revisionDate = None,
slug = None
slug = None,
summary = Seq(ArticleIntroSummary("", lang))
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ case class ArticleIntroSummary(content: String, language: String) extends Langua
}

object ArticleIntroSummary {
implicit def encoder: Encoder[ArticleContent] = deriveEncoder[ArticleContent]
implicit def decoder: Decoder[ArticleContent] = deriveDecoder[ArticleContent]
implicit def encoder: Encoder[ArticleIntroSummary] = deriveEncoder[ArticleIntroSummary]
implicit def decoder: Decoder[ArticleIntroSummary] = deriveDecoder[ArticleIntroSummary]
}

0 comments on commit 02a390f

Please sign in to comment.