(t *testing.T)
| 109 | } |
| 110 | |
| 111 | func 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 | } |
nothing calls this directly
no test coverage detected