File: types_test.go

package info (click to toggle)
golang-github-henrybear327-go-proton-api 1.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,088 kB
  • sloc: sh: 55; makefile: 26
file content (23 lines) | stat: -rw-r--r-- 425 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package backend

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func TestID(t *testing.T) {
	var v ID

	// We can set the ID from a string.
	require.NoError(t, v.FromString("AQIDBA=="))

	// We can get the ID as a string.
	require.Equal(t, "AQIDBA==", v.String())

	// We can get the ID as bytes.
	require.Equal(t, []byte{1, 2, 3, 4}, v.Bytes())

	// The ID is correct.
	require.Equal(t, ID(0x01020304), v)
}