apicontext
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
package grpc_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"gotemplate/api/grpc/spec"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestName(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
conn, cleanup := createDependencies(t, ctx)
|
||||
defer cleanup()
|
||||
|
||||
client := spec.NewNameClient(conn)
|
||||
|
||||
name := "Doczy.ai"
|
||||
|
||||
_, err := client.Get(ctx, &spec.NameMessage{
|
||||
Name: name,
|
||||
})
|
||||
|
||||
assert.NotNil(t, err)
|
||||
|
||||
response, err := client.Add(ctx, &spec.NameMessage{
|
||||
Name: name,
|
||||
})
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, name, response.Name)
|
||||
|
||||
response, err = client.Get(ctx, &spec.NameMessage{
|
||||
Name: name,
|
||||
})
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, name, response.Name)
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package grpc_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"gotemplate/api/grpc/spec"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestName(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
conn, cleanup := createDependencies(t, ctx)
|
||||
defer cleanup()
|
||||
|
||||
client := spec.NewQueryServiceClient(conn)
|
||||
|
||||
id := "sample_id"
|
||||
|
||||
_, err := client.Get(ctx, &spec.IdMessage{
|
||||
Id: id,
|
||||
})
|
||||
|
||||
assert.NotNil(t, err)
|
||||
}
|
||||
@@ -23,7 +23,7 @@ func TestSync(t *testing.T) {
|
||||
defer db.Close(ctx)
|
||||
|
||||
queries := repository.New(db)
|
||||
docSvc := document.New(ctx, queries)
|
||||
docSvc := document.New(queries)
|
||||
|
||||
doc := document.Document{
|
||||
ID: uuid.New(),
|
||||
|
||||
Reference in New Issue
Block a user