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:
@@ -47,37 +47,35 @@ func TestQueryRunner(t *testing.T) {
|
||||
QuerySync: svc,
|
||||
})
|
||||
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
doc := querysyncrunner.Body{
|
||||
DocumentID: uuid.New(),
|
||||
}
|
||||
doc := querysyncrunner.Body{
|
||||
DocumentID: uuid.New(),
|
||||
}
|
||||
|
||||
reqId := uuid.New()
|
||||
qs := []uuid.UUID{
|
||||
reqId,
|
||||
}
|
||||
reqId := uuid.New()
|
||||
qs := []uuid.UUID{
|
||||
reqId,
|
||||
}
|
||||
|
||||
pool.ExpectQuery("name: IsDocumentTextExtracted :one").WithArgs(doc.DocumentID).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"isextracted"}).
|
||||
AddRow(true),
|
||||
)
|
||||
pool.ExpectQuery("name: ListUnsyncedNoDepsQueriesByDocId :many").WithArgs(&doc.DocumentID).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id"}).
|
||||
AddRow(&reqId),
|
||||
)
|
||||
pool.ExpectQuery("name: IsDocumentTextExtracted :one").WithArgs(doc.DocumentID).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"isextracted"}).
|
||||
AddRow(true),
|
||||
)
|
||||
pool.ExpectQuery("name: ListUnsyncedNoDepsQueriesByDocId :many").WithArgs(&doc.DocumentID).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id"}).
|
||||
AddRow(&reqId),
|
||||
)
|
||||
|
||||
mockSQS.EXPECT().
|
||||
SendMessage(
|
||||
mock.Anything,
|
||||
mock.MatchedBy(func(in *sqs.SendMessageInput) bool {
|
||||
return *in.QueueUrl == cfg.QueryURL && *in.MessageBody == fmt.Sprintf("{\"document_id\":\"%s\",\"query_id\":\"%s\"}", doc.DocumentID.String(), qs[0].String())
|
||||
}),
|
||||
mock.Anything,
|
||||
).
|
||||
Return(&sqs.SendMessageOutput{}, nil)
|
||||
mockSQS.EXPECT().
|
||||
SendMessage(
|
||||
mock.Anything,
|
||||
mock.MatchedBy(func(in *sqs.SendMessageInput) bool {
|
||||
return *in.QueueUrl == cfg.QueryURL && *in.MessageBody == fmt.Sprintf("{\"document_id\":\"%s\",\"query_id\":\"%s\"}", doc.DocumentID.String(), qs[0].String())
|
||||
}),
|
||||
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