-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9df6bb3
commit e6fc2cf
Showing
10 changed files
with
80 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/commonTest/kotlin/dev/evo/elasticmagic/FieldTypeTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package dev.evo.elasticmagic | ||
|
||
import io.kotest.matchers.shouldBe | ||
import kotlinx.datetime.LocalDateTime | ||
|
||
import kotlin.test.Test | ||
|
||
class FieldTypeTests { | ||
@Test | ||
fun dateSerialize() { | ||
DateType.serialize(LocalDateTime(2015, 1, 1, 12, 10, 30)) shouldBe "2015-01-01T12:10:30Z" | ||
DateType.serialize(LocalDateTime(2015, 1, 1, 12, 10, 30, 1_000_000)) shouldBe "2015-01-01T12:10:30.001Z" | ||
} | ||
|
||
@Test | ||
fun dateDeserialize() { | ||
DateType.deserialize(0) shouldBe LocalDateTime(1970, 1, 1, 0, 0, 0) | ||
DateType.deserialize(1618249875_000) shouldBe LocalDateTime(2021, 4, 12, 17, 51, 15) | ||
DateType.deserialize("2015-01-01T12:10:30Z") shouldBe LocalDateTime(2015, 1, 1, 12, 10, 30) | ||
DateType.deserialize("2015-01-01T12:10:30.001Z") shouldBe LocalDateTime(2015, 1, 1, 12, 10, 30, 1_000_000) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters