Merged in feature/checkbox (pull request #145)
Checkbox Primary Edge Cases * hascheckboxlogic * gen * preppinggen * exploringcheckbox * removeunselected * tests * failingtest * failintests * nomockqueryapi * db * name * nocontainer * deleterow * cnc * extradocsandupdatetextracts * moretables * appndedtables * baseversion
This commit is contained in:
@@ -44,44 +44,42 @@ func TestQueryRunner(t *testing.T) {
|
||||
Sync: svc,
|
||||
})
|
||||
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
doc := queryversionsyncrunner.Body{
|
||||
QueryID: uuid.New(),
|
||||
}
|
||||
doc := queryversionsyncrunner.Body{
|
||||
QueryID: uuid.New(),
|
||||
}
|
||||
|
||||
clientOne := "hello"
|
||||
clientTwo := "bye"
|
||||
clientIds := []string{
|
||||
clientOne,
|
||||
clientTwo,
|
||||
}
|
||||
clientOne := "hello"
|
||||
clientTwo := "bye"
|
||||
clientIds := []string{
|
||||
clientOne,
|
||||
clientTwo,
|
||||
}
|
||||
|
||||
pool.ExpectQuery("name: ListQueryClientIDs :many").WithArgs(&doc.QueryID).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"clientId"}).
|
||||
AddRow(clientOne).
|
||||
AddRow(clientTwo),
|
||||
)
|
||||
pool.ExpectQuery("name: ListQueryClientIDs :many").WithArgs(&doc.QueryID).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"clientId"}).
|
||||
AddRow(clientOne).
|
||||
AddRow(clientTwo),
|
||||
)
|
||||
|
||||
mockSQS.EXPECT().
|
||||
SendMessage(
|
||||
mock.Anything,
|
||||
mock.MatchedBy(func(in *sqs.SendMessageInput) bool {
|
||||
return *in.QueueUrl == cfg.ClientSyncURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", clientIds[0])
|
||||
}),
|
||||
mock.Anything,
|
||||
).
|
||||
Return(&sqs.SendMessageOutput{}, nil)
|
||||
mockSQS.EXPECT().
|
||||
SendMessage(
|
||||
mock.Anything,
|
||||
mock.MatchedBy(func(in *sqs.SendMessageInput) bool {
|
||||
return *in.QueueUrl == cfg.ClientSyncURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", clientIds[1])
|
||||
}),
|
||||
mock.Anything,
|
||||
).
|
||||
Return(&sqs.SendMessageOutput{}, nil)
|
||||
mockSQS.EXPECT().
|
||||
SendMessage(
|
||||
mock.Anything,
|
||||
mock.MatchedBy(func(in *sqs.SendMessageInput) bool {
|
||||
return *in.QueueUrl == cfg.ClientSyncURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", clientIds[0])
|
||||
}),
|
||||
mock.Anything,
|
||||
).
|
||||
Return(&sqs.SendMessageOutput{}, nil)
|
||||
mockSQS.EXPECT().
|
||||
SendMessage(
|
||||
mock.Anything,
|
||||
mock.MatchedBy(func(in *sqs.SendMessageInput) bool {
|
||||
return *in.QueueUrl == cfg.ClientSyncURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", clientIds[1])
|
||||
}),
|
||||
mock.Anything,
|
||||
).
|
||||
Return(&sqs.SendMessageOutput{}, nil)
|
||||
|
||||
assert.True(t, runner.Process(ctx, doc))
|
||||
})
|
||||
assert.True(t, runner.Process(ctx, doc))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user