mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-01 08:48:46 +02:00
617c8c787d
Unified User Action (UUA) is a centralized, real-time stream of user actions on Twitter, consumed by various product, ML, and marketing teams. UUA makes sure all internal teams consume the uniformed user actions data in an accurate and fast way.
30 lines
893 B
Scala
30 lines
893 B
Scala
package com.twitter.unified_user_actions.adapter
|
|
|
|
import com.twitter.inject.Test
|
|
import com.twitter.unified_user_actions.adapter.common.AdapterUtils
|
|
import com.twitter.util.Time
|
|
|
|
class AdapterUtilsSpec extends Test {
|
|
trait Fixture {
|
|
|
|
val frozenTime: Time = Time.fromMilliseconds(1658949273000L)
|
|
val languageCode = "en"
|
|
val countryCode = "us"
|
|
}
|
|
|
|
test("tests") {
|
|
new Fixture {
|
|
Time.withTimeAt(frozenTime) { _ =>
|
|
val actual = Time.fromMilliseconds(AdapterUtils.currentTimestampMs)
|
|
assert(frozenTime === actual)
|
|
}
|
|
|
|
val actionedTweetId = 1554576940756246272L
|
|
assert(AdapterUtils.getTimestampMsFromTweetId(actionedTweetId) === 1659474999976L)
|
|
|
|
assert(languageCode.toUpperCase === AdapterUtils.normalizeLanguageCode(languageCode))
|
|
assert(countryCode.toUpperCase === AdapterUtils.normalizeCountryCode(countryCode))
|
|
}
|
|
}
|
|
}
|