Skip to content

Commit 4264f35

Browse files
authored
Fix query for unit test framework (#535)
1 parent 4be6b26 commit 4264f35

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

internal/internal_workflow_testsuite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1469,7 +1469,7 @@ func (env *testWorkflowEnvironmentImpl) signalWorkflow(name string, input interf
14691469
}
14701470

14711471
func (env *testWorkflowEnvironmentImpl) queryWorkflow(queryType string, args ...interface{}) (encoded.Value, error) {
1472-
data, err := encodeArg(env.GetDataConverter(), args)
1472+
data, err := encodeArgs(env.GetDataConverter(), args)
14731473
if err != nil {
14741474
return nil, err
14751475
}

internal/internal_workflow_testsuite_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,8 +1260,8 @@ func (s *WorkflowTestSuiteUnitTest) Test_QueryWorkflow() {
12601260
stateWaitSignal, stateWaitActivity, stateDone := "wait for signal", "wait for activity", "done"
12611261
workflowFn := func(ctx Context) error {
12621262
var state string
1263-
err := SetQueryHandler(ctx, queryType, func() (string, error) {
1264-
return state, nil
1263+
err := SetQueryHandler(ctx, queryType, func(queryInput string) (string, error) {
1264+
return queryInput + state, nil
12651265
})
12661266
if err != nil {
12671267
return err
@@ -1284,12 +1284,13 @@ func (s *WorkflowTestSuiteUnitTest) Test_QueryWorkflow() {
12841284

12851285
env := s.NewTestWorkflowEnvironment()
12861286
verifyStateWithQuery := func(expected string) {
1287-
encodedValue, err := env.QueryWorkflow(queryType)
1287+
encodedValue, err := env.QueryWorkflow(queryType, "input")
12881288
s.NoError(err)
1289+
s.NotNil(encodedValue)
12891290
var state string
12901291
err = encodedValue.Get(&state)
12911292
s.NoError(err)
1292-
s.Equal(expected, state)
1293+
s.Equal("input"+expected, state)
12931294
}
12941295
env.RegisterDelayedCallback(func() {
12951296
verifyStateWithQuery(stateWaitSignal)

0 commit comments

Comments
 (0)