@@ -238,6 +238,7 @@ func TestPostgresEntityIntegration(t *testing.T) {
238
238
t .Run ("Invoke findAll" , func (t * testing.T ) {
239
239
res , err := b .Invoke (ctx , req )
240
240
assertResponse (t , res , err )
241
+ assert .Equal (t , string (res .Data ), "[]" )
241
242
})
242
243
243
244
req = & bindings.InvokeRequest {
@@ -246,7 +247,7 @@ func TestPostgresEntityIntegration(t *testing.T) {
246
247
commandEntityName : "customers" },
247
248
}
248
249
t .Run ("Invoke save" , func (t * testing.T ) {
249
- // The following payload is a json payload that's why it has weird quoting
250
+ // @TODO: we should marshal a customer struct to JSON, but it will not be an array
250
251
req .Metadata [commandEntityProps ] = "[\" 'salaboy'\" ,\" 'salaboy'\" ,\" 'chiswick'\" , \" 'london'\" , \" 'w4'\" ,\" 'uk'\" ]"
251
252
res , err := b .Invoke (ctx , req )
252
253
assertResponse (t , res , err )
@@ -260,6 +261,21 @@ func TestPostgresEntityIntegration(t *testing.T) {
260
261
t .Run ("Invoke findAll" , func (t * testing.T ) {
261
262
res , err := b .Invoke (ctx , req )
262
263
assertResponse (t , res , err )
264
+ assert .NotNil (t , res .Data )
265
+ //@TODO: we can marshal this into a customer struct and validate props
266
+ assert .Contains (t , string (res .Data ), "\" salaboy\" ,\" salaboy\" ,\" chiswick\" ,\" london\" ,\" w4\" ,\" uk\" " )
267
+ })
268
+
269
+ req = & bindings.InvokeRequest {
270
+ Operation : deleteAllOperation ,
271
+ Metadata : map [string ]string {operationType : "entity" ,
272
+ commandEntityName : "customers" },
273
+ }
274
+ t .Run ("Invoke delete all" , func (t * testing.T ) {
275
+
276
+ res , err := b .Invoke (ctx , req )
277
+ assertResponse (t , res , err )
278
+ assert .Equal (t , res .Metadata ["rows-affected" ], "1" )
263
279
})
264
280
265
281
t .Run ("Close" , func (t * testing.T ) {
0 commit comments