<commit_before>package azure

import models.Topic
import models.TopicTypes.{Content, FootballMatch, TagContributor}
import org.specs2.mutable.Specification

class TagSpec extends Specification {

  "Azure hub tag" should {

    "encode an ugly topic" in {
      val uglyTopic = Topic(name = "test!!.|~ ", `type` = FootballMatch)
      val tag = Tag.fromTopic(uglyTopic)

      Tag(tag.encodedTag) must beEqualTo(tag)
    }

    "encode a pretty topic" in {
      val prettyTopic = Topic(name = "blah/etc-123-stuff", `type` = FootballMatch)
      val tag = Tag.fromTopic(prettyTopic)

      tag.encodedTag must be matching """[0-9a-zA-Z\/:-=]+"""
      Tag(tag.encodedTag) must beEqualTo(tag)
    }

    "encoded tag must end with topic id" in {
      val topic = Topic(name = "profile/josh-halliday", `type` = TagContributor)
      val tag = Tag.fromTopic(topic)

      tag.encodedTag must endWith(topic.id)
    }

    "encoded tag must not exceed 120 characters for long topic names" in {
      val topic = Topic(name = "uk-news/live/2016/apr/26/hillsborough-disaster-inquest-jury-returns-verdict-live-updates", `type` = Content)
      val tag = Tag.fromTopic(topic)

      tag.encodedTag must haveLength(beLessThan(120))
    }
  }
}<commit_msg>adding tags spec test case back<commit_after>package azure

import java.util.UUID

import models.{IosUdid, Topic, UniqueDeviceIdentifier}
import models.TopicTypes.{Content, FootballMatch, TagContributor}
import org.specs2.mutable.Specification

class TagSpec extends Specification {

  "Azure hub tag" should {

    "encode an ugly topic" in {
      val uglyTopic = Topic(name = "test!!.|~ ", `type` = FootballMatch)
      val tag = Tag.fromTopic(uglyTopic)

      Tag(tag.encodedTag) must beEqualTo(tag)
    }

    "encode a pretty topic" in {
      val prettyTopic = Topic(name = "blah/etc-123-stuff", `type` = FootballMatch)
      val tag = Tag.fromTopic(prettyTopic)

      tag.encodedTag must be matching """[0-9a-zA-Z\/:-=]+"""
      Tag(tag.encodedTag) must beEqualTo(tag)
    }

    "encoded tag must end with topic id" in {
      val topic = Topic(name = "profile/josh-halliday", `type` = TagContributor)
      val tag = Tag.fromTopic(topic)

      tag.encodedTag must endWith(topic.id)
    }

    "encoded tag must not exceed 120 characters for long topic names" in {
      val topic = Topic(name = "uk-news/live/2016/apr/26/hillsborough-disaster-inquest-jury-returns-verdict-live-updates", `type` = Content)
      val tag = Tag.fromTopic(topic)

      tag.encodedTag must haveLength(beLessThan(120))
    }

    "encoded tag must contain user id" in {
      val uuid = UUID.randomUUID
      val userId = UniqueDeviceIdentifier(uuid)
      val tag = Tag.fromUserId(userId)

      tag.encodedTag must endWith(uuid.toString)
    }

    "encoded tag should not be influenced by 'gia:' prefix" in {
      val uuid = UUID.randomUUID
      val userId = UniqueDeviceIdentifier(uuid)
      val userIdWithPrefix = new IosUdid(s"gia:$uuid", uuid)
      Tag.fromUserId(userId) must beEqualTo(Tag.fromUserId(userIdWithPrefix))
    }

    "encoded tag should not be influenced by uuid case" in {
      val uuid = UUID.randomUUID
      val userIdUppercase = new IosUdid(s"gia:${uuid.toString.toUpperCase}", uuid)
      val userIdLowercase = new IosUdid(s"gia:$uuid", uuid)
      Tag.fromUserId(userIdUppercase) must beEqualTo(Tag.fromUserId(userIdLowercase))
    }
  }
}
{'fraction_non_alphanumeric': 0.11345646437994723, 'fraction_numerical': 0.010554089709762533, 'mean_word_length': 3.270337922403004, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '964144', 'n_tokens_mistral': 1134, 'n_tokens_neox': 1101, 'n_words': 280}