MCPcopy Create free account
hub / github.com/blues/note / TestBulkDecode

Function TestBulkDecode

lib/bulk_test.go:28–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26}
27
28func TestBulkDecode(t *testing.T) {
29 ctx := context.Background()
30 context, err := BulkDecodeTemplate(
31 ctx,
32 []byte(`{"format":2,"storage":"file:data/test_note-qo.000","template_body":"{\"id\":24,\"description\":\"type_hint\"}","template_payload":1024}`),
33 []byte{167, 1, 152, 1, 38, 0, 2, 182, 219, 68, 209, 235, 39, 23, 137, 112, 31, 54, 63, 130, 138, 24, 0, 0, 0, 0, 13, 0, 49, 50, 56, 32, 98, 121, 116, 101, 32, 110, 111, 116, 101, 128, 1, 20, 254, 1, 0, 238, 1, 0},
34 )
35 require.NoError(t, err)
36
37 body, payload, when, wherewhen, olc, _, success := context.BulkDecodeNextEntry(ctx)
38
39 require.Equal(t, map[string]interface{}{"description": "128 byte note"}, body)
40 require.Equal(t, bytes.Repeat([]byte{0}, 128), payload)
41 require.Equal(t, int64(1668561471), when)
42 require.Equal(t, int64(1668561470), wherewhen)
43 require.Equal(t, "87JC9RF9+86XJ", olc)
44 require.Equal(t, true, success)
45
46 body, payload, when, wherewhen, olc, _, success = context.BulkDecodeNextEntry(ctx)
47
48 require.Nil(t, body)
49 require.Nil(t, payload)
50 require.Equal(t, int64(0), when)
51 require.Equal(t, int64(0), wherewhen)
52 require.Equal(t, "", olc)
53 require.Equal(t, false, success)
54}
55
56func TestBulkEncode(t *testing.T) {
57 ctx := context.Background()

Callers

nothing calls this directly

Calls 2

BulkDecodeTemplateFunction · 0.85
BulkDecodeNextEntryMethod · 0.80

Tested by

no test coverage detected