MCPcopy
hub / github.com/ory/keto / TestBuildInsertUUIDs

Function TestBuildInsertUUIDs

internal/persistence/sql/query_test.go:111–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

109}
110
111func TestBuildInsertUUIDs(t *testing.T) {
112 t.Parallel()
113
114 foo, bar, baz := uuidx.NewV4(), uuidx.NewV4(), uuidx.NewV4()
115 uuids := []UUIDMapping{
116 {foo, "foo"},
117 {bar, "bar"},
118 {baz, "baz"},
119 }
120
121 q, args := buildInsertUUIDs(uuids, "mysql")
122 assert.Equal(t, "INSERT IGNORE INTO keto_uuid_mappings (id, string_representation) VALUES (?,?),(?,?),(?,?)", q)
123 assert.Equal(t, []any{foo, "foo", bar, "bar", baz, "baz"}, args)
124
125 q, args = buildInsertUUIDs(uuids, "anything else")
126 assert.Equal(t, "INSERT INTO keto_uuid_mappings (id, string_representation) VALUES (?,?),(?,?),(?,?) ON CONFLICT (id) DO NOTHING", q)
127 assert.Equal(t, []any{foo, "foo", bar, "bar", baz, "baz"}, args)
128}

Callers

nothing calls this directly

Calls 1

buildInsertUUIDsFunction · 0.85

Tested by

no test coverage detected