<commit_before>package uk.ac.wellcome.platform.transformer.miro.source

import org.scalatest.{FunSpec, Matchers}
import uk.ac.wellcome.json.JsonUtil._

class MiroRecordTest extends FunSpec with Matchers {

  // This is based on failures we've seen in the pipeline.
  // Examples: L0068740, V0014729.
  it("parses a JSON string with nulls in the image_keywords_unauth field") {
    val jsonString =
      """
        |{
        |    "image_keywords_unauth": [null, null]
        |}
        |
      """.stripMargin

    fromJson[MiroRecord](jsonString).isSuccess shouldBe true
  }

  // This is based on bugs from data in the pipeline.
  it("corrects the entities in Adêle Mongrédien's name") {
    val jsonString =
      """
        |{
        |  "image_creator": ["Ad\u00c3\u00aale Mongr\u00c3\u00a9dien"]
        |}
      """.stripMargin

    MiroRecord.create(jsonString).creator shouldBe Some(
      List(Some("Ad<NAME>")))<commit_msg>Get MiroRecordTest passing<commit_after>package uk.ac.wellcome.platform.transformer.miro.source

import org.scalatest.{FunSpec, Matchers}
import uk.ac.wellcome.json.JsonUtil._

class MiroRecordTest extends FunSpec with Matchers {

  // This is based on failures we've seen in the pipeline.
  // Examples: L0068740, V0014729.
  it("parses a JSON string with nulls in the image_keywords_unauth field") {
    val jsonString =
      """
        |{
        |  "image_no_calc": "L0068740",
        |  "image_keywords_unauth": [null, null]
        |}
        |
      """.stripMargin

    fromJson[MiroRecord](jsonString).isSuccess shouldBe true
  }

  // This is based on bugs from data in the pipeline.
  it("corrects the entities in Adêle Mongrédien's name") {
    val jsonString =
      """
        |{
        |  "image_no_calc": "A0000001",
        |  "image_creator": ["Ad\u00c3\u00a<NAME>\u00c3\u00a9dien"]
        |}
      """.stripMargin

    MiroRecord.create(jsonString).creator shouldBe Some(
      List(Some("<NAME>")))
{'fraction_non_alphanumeric': 0.11722731906218145, 'fraction_numerical': 0.0326197757390418, 'mean_word_length': 2.833984375, 'pattern_counts': {'":': 6, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5837942', 'n_tokens_mistral': 701, 'n_tokens_neox': 649, 'n_words': 148}