-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Elastic primitive for UUID (#183)
- Loading branch information
Showing
9 changed files
with
61 additions
and
22 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
40 changes: 40 additions & 0 deletions
40
modules/library/src/test/scala/zio/elasticsearch/ElasticPrimitiveSpec.scala
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,40 @@ | ||
package zio.elasticsearch | ||
|
||
import zio.elasticsearch.ElasticQuery._ | ||
import zio.elasticsearch.query.Match | ||
import zio.test.Assertion.equalTo | ||
import zio.test._ | ||
|
||
import java.util.UUID | ||
|
||
object ElasticPrimitiveSpec extends ZIOSpecDefault { | ||
override def spec: Spec[TestEnvironment, Any] = | ||
suite("Elastic Primitives")( | ||
test("successfully create matches query with String") { | ||
assert(matches(FieldName, "string"))(equalTo(Match[Any, String](FieldName, "string", boost = None))) | ||
}, | ||
test("successfully create matches query with BigDecimal") { | ||
assert(matches(FieldName, BigDecimal(1)))( | ||
equalTo(Match[Any, BigDecimal](FieldName, BigDecimal(1), boost = None)) | ||
) | ||
}, | ||
test("successfully create matches query with Boolean") { | ||
assert(matches(FieldName, true))(equalTo(Match[Any, Boolean](FieldName, true, boost = None))) | ||
}, | ||
test("successfully create matches query with Double") { | ||
assert(matches(FieldName, 1.00))(equalTo(Match[Any, Double](FieldName, 1.00, boost = None))) | ||
}, | ||
test("successfully create matches query with Int") { | ||
assert(matches(FieldName, 1))(equalTo(Match[Any, Int](FieldName, 1, boost = None))) | ||
}, | ||
test("successfully create matches query with Long") { | ||
assert(matches(FieldName, 1L))(equalTo(Match[Any, Long](FieldName, 1L, boost = None))) | ||
}, | ||
test("successfully create matches query with UUID") { | ||
val uuid = UUID.randomUUID() | ||
assert(matches(FieldName, uuid))(equalTo(Match[Any, UUID](FieldName, uuid, boost = None))) | ||
} | ||
) | ||
|
||
private val FieldName = "fieldName" | ||
} |
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