Wrote write goroutine functions.

Refactored subpackages back to root package.
This commit is contained in:
Jay
2026-03-04 18:33:42 -05:00
parent f88982a0b7
commit 894eab5405
17 changed files with 450 additions and 217 deletions

43
cypher_test.go Normal file
View File

@@ -0,0 +1,43 @@
package heartwood
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestToCypherLabel(t *testing.T) {
assert.Equal(t, ":`Event`", ToCypherLabel("Event"))
}
func TestToCypherLabels(t *testing.T) {
assert.Equal(t, ":`Event`:`ReplaceableEvent`",
ToCypherLabels([]string{"Event", "ReplaceableEvent"}))
}
func TestToCypherProps(t *testing.T) {
cases := []struct {
name string
keys []string
prefix string
expected string
}{
{
name: "default prefix",
keys: []string{"id", "name"},
prefix: "",
expected: "id: $id, name: $name",
},
{
name: "set prefix",
keys: []string{"id", "name"},
prefix: "entity.",
expected: "id: entity.id, name: entity.name",
},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
assert.Equal(t, tc.expected, ToCypherProps(tc.keys, tc.prefix))
})
}
}