Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert InterpolatorTypeTest to Kotlin #37724

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.uimanager.layoutanimation

import java.util.Locale
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner

@RunWith(RobolectricTestRunner::class)
class InterpolatorTypeTest {
@Test
fun testCamelCase() {
assertThat(InterpolatorType.fromString("linear")).isEqualTo(InterpolatorType.LINEAR)
assertThat(InterpolatorType.fromString("easeIn")).isEqualTo(InterpolatorType.EASE_IN)
assertThat(InterpolatorType.fromString("easeOut")).isEqualTo(InterpolatorType.EASE_OUT)
assertThat(InterpolatorType.fromString("easeInEaseOut"))
.isEqualTo(InterpolatorType.EASE_IN_EASE_OUT)
assertThat(InterpolatorType.fromString("spring")).isEqualTo(InterpolatorType.SPRING)
}

@Test
fun testOtherCases() {
assertThat(InterpolatorType.fromString("EASEIN")).isEqualTo(InterpolatorType.EASE_IN)
assertThat(InterpolatorType.fromString("easeout")).isEqualTo(InterpolatorType.EASE_OUT)
assertThat(InterpolatorType.fromString("easeineaseout"))
.isEqualTo(InterpolatorType.EASE_IN_EASE_OUT)
}

@Test
fun testLocales() {
Locale.setDefault(Locale.forLanguageTag("tr-TR"))
assertThat(InterpolatorType.fromString("easeInEaseOut"))
.isEqualTo(InterpolatorType.EASE_IN_EASE_OUT)
}

@Test(expected = IllegalArgumentException::class)
@Throws(IllegalArgumentException::class)
fun testInvalidInterpolatorTypes() {
InterpolatorType.fromString("ease_in_ease_out")
}
}