Debian Codegraph @

jwa/secp2561k_test.go

raw symbols SCIP
1 //go:build jwx_es256k
2
3 package jwa_test
4
5 import (
6 "encoding/json"
7 "fmt"
8 "testing"
9
10 "github.com/lestrrat-go/jwx/v3/jwa"
11 "github.com/stretchr/testify/require"
12 )
13
14 func TestSecp256k1(t *testing.T) {
15 t.Parallel()
16 t.Run(`accept jwa constant Secp256k1`, func(t *testing.T) {
17 t.Parallel()
18 var dst jwa.EllipticCurveAlgorithm
19 require.NoError(t, json.Unmarshal([]byte(fmt.Sprintf("%q", jwa.Secp256k1().String())), &dst), `Unmarshal is successful`)
20 require.Equal(t, jwa.Secp256k1(), dst, `accepted value should be equal to constant`)
21 })
22 t.Run(`stringification for secp256k1`, func(t *testing.T) {
23 t.Parallel()
24 require.Equal(t, "secp256k1", jwa.Secp256k1().String(), `stringified value matches`)
25 })
26 }