Skip to content

Commit

Permalink
adds test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwiniag committed Dec 20, 2024
1 parent 9b8214a commit 8288d7b
Show file tree
Hide file tree
Showing 5 changed files with 287 additions and 15 deletions.
15 changes: 8 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ go 1.23.0
toolchain go1.23.1

require (
entgo.io/ent v0.14.1
github.com/google/uuid v1.3.0
github.com/lib/pq v1.10.9
github.com/mattn/go-sqlite3 v1.14.16
github.com/robfig/cron/v3 v3.0.1
github.com/scriptnull/jsonseal v0.3.0
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.8.2
github.com/swaggest/openapi-go v0.2.54
github.com/swaggest/rest v0.2.68
github.com/swaggest/swgui v1.8.2
Expand All @@ -18,21 +23,18 @@ require (

require (
ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43 // indirect
entgo.io/ent v0.14.1 // indirect
github.com/agext/levenshtein v1.2.1 // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-chi/chi/v5 v5.1.0 // indirect
github.com/go-openapi/inflect v0.19.0 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/hcl/v2 v2.13.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/santhosh-tekuri/jsonschema/v3 v3.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand All @@ -42,8 +44,7 @@ require (
github.com/vearutop/statigz v1.4.0 // indirect
github.com/zclconf/go-cty v1.8.0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.26.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
21 changes: 13 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43 h1:GwdJbXydHCYPedeeLt4x/lrl
ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43/go.mod h1:uj3pm+hUTVN/X5yfdBexHlZv+1Xu5u5ZbZx7+CDavNU=
entgo.io/ent v0.14.1 h1:fUERL506Pqr92EPHJqr8EYxbPioflJo6PudkrEA8a/s=
entgo.io/ent v0.14.1/go.mod h1:MH6XLG0KXpkcDQhKiHfANZSzR55TJyPL5IGNpI8wpco=
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8=
Expand All @@ -28,6 +30,8 @@ github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw=
github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
Expand All @@ -49,14 +53,14 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM=
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand All @@ -77,7 +81,11 @@ github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3k
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/swaggest/assertjson v1.9.0 h1:dKu0BfJkIxv/xe//mkCrK5yZbs79jL7OVf9Ija7o2xQ=
Expand Down Expand Up @@ -113,17 +121,13 @@ golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand All @@ -132,5 +136,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
99 changes: 99 additions & 0 deletions internal/restapi/v1/integrationtype/tests/get_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package integrationtype

import (
"context"
_ "github.com/mattn/go-sqlite3"
"github.com/shinobistack/gokakashi/ent/enttest"
"github.com/shinobistack/gokakashi/internal/restapi/v1/integrationtype"
"github.com/stretchr/testify/assert"
"testing"
)

func TestGetIntegrationType_ValidID(t *testing.T) {
client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
defer client.Close()

// Seed data
_, _ = client.IntegrationType.Create().
SetID("linear").
SetDisplayName("Linear Integration").
Save(context.Background())

// Test case: Valid ID
req := integrationtype.GetIntegrationTypeRequests{ID: "linear"}
res := &integrationtype.GetIntegrationTypeResponse{}
handler := integrationtype.GetIntegrationType(client)
err := handler(context.Background(), req, res)

assert.NoError(t, err)
assert.Equal(t, "linear", res.ID)
assert.Equal(t, "Linear Integration", res.DisplayName)
}

func TestGetIntegrationType_NonExistentID(t *testing.T) {
client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
defer client.Close()

req := integrationtype.GetIntegrationTypeRequests{ID: "nonexistent"}
res := &integrationtype.GetIntegrationTypeResponse{}
handler := integrationtype.GetIntegrationType(client)
err := handler(context.Background(), req, res)

assert.Error(t, err)
assert.Contains(t, err.Error(), "integration type not found")
}

func TestGetIntegrationType_InvalidIDFormat(t *testing.T) {
client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
defer client.Close()

req := integrationtype.GetIntegrationTypeRequests{ID: "Invalid ID!"}
res := &integrationtype.GetIntegrationTypeResponse{}
handler := integrationtype.GetIntegrationType(client)
err := handler(context.Background(), req, res)

Check failure on line 53 in internal/restapi/v1/integrationtype/tests/get_test.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to err (ineffassign)

req = integrationtype.GetIntegrationTypeRequests{ID: "Inv*ID"}
handler = integrationtype.GetIntegrationType(client)
err = handler(context.Background(), req, res)

assert.Error(t, err)
}

func TestListIntegrationTypes_ValidRequest(t *testing.T) {
client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
defer client.Close()

// Seed data
_, _ = client.IntegrationType.Create().
SetID("linear").
SetDisplayName("Linear Integration").
Save(context.Background())
_, _ = client.IntegrationType.Create().
SetID("jira").
SetDisplayName("Jira Integration").
Save(context.Background())

req := struct{}{}
var res []integrationtype.GetIntegrationTypeResponse
handler := integrationtype.ListIntegrationType(client)
err := handler(context.Background(), req, &res)

assert.NoError(t, err)
assert.Len(t, res, 2)
}

func TestListIntegrations_EmptyDB(t *testing.T) {
client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
defer client.Close()

// Prepare response
var res []integrationtype.GetIntegrationTypeResponse

// Execute ListIntegrations handler
handler := integrationtype.ListIntegrationType(client)
err := handler(context.Background(), struct{}{}, &res)

// Validate response
assert.NoError(t, err)
assert.Len(t, res, 0)
}
84 changes: 84 additions & 0 deletions internal/restapi/v1/integrationtype/tests/post_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package integrationtype

import (
"context"
"github.com/shinobistack/gokakashi/internal/restapi/v1/integrationtype"
"testing"

"github.com/shinobistack/gokakashi/ent/enttest"
"github.com/stretchr/testify/assert"
)

func TestCreateIntegrationType_ValidInput(t *testing.T) {
client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
defer client.Close()

req := integrationtype.CreateIntegrationTypeRequest{
ID: "linear",
DisplayName: "Linear Integration",
}
res := &integrationtype.GetIntegrationTypeResponse{}
handler := integrationtype.CreateIntegrationType(client)
err := handler(context.Background(), req, res)

assert.NoError(t, err)
assert.Equal(t, "linear", res.ID)
assert.Equal(t, "Linear Integration", res.DisplayName)
}

func TestCreateIntegrationType_MissingFields(t *testing.T) {
client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
defer client.Close()

req := integrationtype.CreateIntegrationTypeRequest{}
res := &integrationtype.GetIntegrationTypeResponse{}
handler := integrationtype.CreateIntegrationType(client)
err := handler(context.Background(), req, res)

assert.Error(t, err)
assert.Contains(t, err.Error(), "missing required fields")
}

func TestCreateIntegrationType_InvalidIDFormat(t *testing.T) {
client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
defer client.Close()

req := integrationtype.CreateIntegrationTypeRequest{
ID: "Invalid ID!",
DisplayName: "Valid Format ",
}
res := &integrationtype.GetIntegrationTypeResponse{}
handler := integrationtype.CreateIntegrationType(client)
err := handler(context.Background(), req, res)

Check failure on line 52 in internal/restapi/v1/integrationtype/tests/post_test.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to err (ineffassign)

req = integrationtype.CreateIntegrationTypeRequest{
ID: "invalid",
DisplayName: "Valid Format ",
}
handler = integrationtype.CreateIntegrationType(client)
err = handler(context.Background(), req, res)

assert.Error(t, err)
assert.Contains(t, err.Error(), "invalid id format")
}

func TestCreateIntegrationType_DuplicateID(t *testing.T) {
client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
defer client.Close()

_, _ = client.IntegrationType.Create().
SetID("linear").
SetDisplayName("Linear Integration").
Save(context.Background())

req := integrationtype.CreateIntegrationTypeRequest{
ID: "linear",
DisplayName: "Linear Integration",
}
res := &integrationtype.GetIntegrationTypeResponse{}
handler := integrationtype.CreateIntegrationType(client)
err := handler(context.Background(), req, res)

assert.Error(t, err)
assert.Contains(t, err.Error(), "integration type already exists")
}
83 changes: 83 additions & 0 deletions internal/restapi/v1/integrationtype/tests/put_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package integrationtype

import (
"context"
"github.com/shinobistack/gokakashi/internal/restapi/v1/integrationtype"
"testing"

"github.com/shinobistack/gokakashi/ent/enttest"
"github.com/stretchr/testify/assert"
)

func TestUpdateIntegrationType_ValidUpdate(t *testing.T) {
client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
defer client.Close()

_, _ = client.IntegrationType.Create().
SetID("linear").
SetDisplayName("Linear Integration").
Save(context.Background())

req := integrationtype.UpdateIntegrationTypeRequest{
ID: "linear",
DisplayName: ptr("Updated Linear Integration"),
}
res := &integrationtype.GetIntegrationTypeResponse{}
handler := integrationtype.UpdateIntegrationType(client)
err := handler(context.Background(), req, res)

assert.NoError(t, err)
assert.Equal(t, "linear", res.ID)
assert.Equal(t, "Updated Linear Integration", res.DisplayName)
}

func TestUpdateIntegrationType_InvalidIDFormat(t *testing.T) {
client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
defer client.Close()

req := integrationtype.UpdateIntegrationTypeRequest{
ID: "Invalid ID!",
DisplayName: ptr("Invalid Format"),
}
res := &integrationtype.GetIntegrationTypeResponse{}
handler := integrationtype.UpdateIntegrationType(client)
err := handler(context.Background(), req, res)

assert.Error(t, err)
assert.Contains(t, err.Error(), "invalid id format")
}

func TestUpdateIntegrationType_NonExistentID(t *testing.T) {
client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
defer client.Close()

req := integrationtype.UpdateIntegrationTypeRequest{
ID: "nonexistent",
DisplayName: ptr("Non-existent Integration"),
}
res := &integrationtype.GetIntegrationTypeResponse{}
handler := integrationtype.UpdateIntegrationType(client)
err := handler(context.Background(), req, res)

assert.Error(t, err)
assert.Contains(t, err.Error(), "integration type not found")
}

func TestUpdateIntegrationType_NoFieldsToUpdate(t *testing.T) {
client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
defer client.Close()

req := integrationtype.UpdateIntegrationTypeRequest{
ID: "linear",
DisplayName: nil,
}
var res integrationtype.GetIntegrationTypeResponse
handler := integrationtype.UpdateIntegrationType(client)
err := handler(context.Background(), req, &res)

assert.Error(t, err)
}

func ptr(value string) *string {
return &value
}

0 comments on commit 8288d7b

Please sign in to comment.