Skip to content

Commit

Permalink
Add workflow test for Contacts.saveContatcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuntao Lu committed Apr 12, 2018
1 parent 42c7365 commit 5074e69
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions examples/example-gateway/endpoints/contacts/save_contacts_test.go
Expand Up @@ -2,10 +2,12 @@ package contacts_test

import (
"bytes"
"context"
"testing"

"github.com/stretchr/testify/assert"

"github.com/uber/zanzibar/examples/example-gateway/build/endpoints/contacts/mock-workflow"
endpointContacts "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/contacts/contacts"
ms "github.com/uber/zanzibar/examples/example-gateway/build/services/example-gateway/mock-service"
)
Expand All @@ -31,3 +33,22 @@ func TestSaveContactsCall(t *testing.T) {

assert.Equal(t, "202 Accepted", res.Status)
}

func TestSaveContactsCallWorkflow(t *testing.T) {
mh, mc := mockcontactsworkflow.NewContactsSaveContactsWorkflowMock(t)

mc.Contacts.ExpectSaveContacts().Success()

endpointReqeust := &endpointContacts.SaveContactsRequest{
UserUUID: "foo",
Contacts: []*endpointContacts.Contact{},
}

res, resHeaders, err := mh.Handle(context.Background(), nil, endpointReqeust)

if !assert.NoError(t, err, "got error") {
return
}
assert.Nil(t, resHeaders)
assert.Equal(t, &endpointContacts.SaveContactsResponse{}, res)
}

0 comments on commit 5074e69

Please sign in to comment.