• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hyperledger / identus-cloud-agent / 11056380298

26 Sep 2024 04:28PM CUT coverage: 48.66% (+0.05%) from 48.609%
11056380298

Pull #1375

yshyn-iohk
fix: migration to a new eudi.openid4vci library

Signed-off-by: Yurii Shynbuiev <yurii.shynbuiev@iohk.io>
Pull Request #1375: fix: OAS and http clients for Kotliln and TypeScript

34 of 81 new or added lines in 25 files covered. (41.98%)

182 existing lines in 53 files now uncovered.

7860 of 16153 relevant lines covered (48.66%)

0.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

5.88
/cloud-agent/service/server/src/main/scala/org/hyperledger/identus/api/http/codec/OrderCodec.scala
1
package org.hyperledger.identus.api.http.codec
2

3
import org.hyperledger.identus.api.http.model.Order
4
import org.hyperledger.identus.api.http.model.Order.Direction
5
import sttp.tapir.{Codec, DecodeResult}
6
import sttp.tapir.Codec.PlainCodec
7

8
import java.util.Base64
9

10
object OrderCodec {
11
  implicit def orderCodec: PlainCodec[Order] = {
1✔
12
    def decode(s: String): DecodeResult[Order] =
×
13
      try {
×
14
        val s2 = new String(Base64.getDecoder.decode(s))
×
15
        val order = s2.split(".", 2) match {
×
16
          case Array()          => Order.empty
×
17
          case Array(field)     => Order(field)
×
18
          case Array(field, "") => Order(field)
×
19
          case Array(field, direction) =>
×
20
            Order(field, Some(Direction.valueOf(direction)))
21
          case _ => sys.error("impossible")
×
22
        }
23
        DecodeResult.Value(order)
24
      } catch {
25
        case e: Exception => DecodeResult.Error(s, e)
×
26
      }
27

28
    def encode(order: Order): String =
×
29
      Base64.getEncoder
×
30
        .encodeToString(
×
31
          s"${order.field}.${order.direction.getOrElse(Order.DefaultDirection).toString}"
×
32
            .getBytes("UTF-8")
×
33
        )
34

UNCOV
35
    Codec.string.mapDecode(decode)(encode)
×
36
  }
37
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc