Skip to content

testing gap for database adapters? #1902

@lwhiteley

Description

@lwhiteley

Steps to reproduce

adapter test cases do not cover the total count in cases where the data is filtered but data set is actually larger

I recently wrote an adapter and the pagination was returning the full count in the database even when filtered but all test cases passed anyway.

is this the expected behaviour or a test gap?

for eg.

Dataset:

[
   {
      "type":"urgent",
      "message":"tester is testing"
   },
   {
      "type":"not-urgent",
      "message":"tester is testing"
   },
   {
      "type":"urgent",
      "message":"tester is testing"
   },
   {
      "type":"not-urgent",
      "message":"tester is testing"
   }
]

Query: /messages?type=urgent

What should be the expected result?

Result 1: Test passes 🆗

{
   "total": 4,
   "data":[
   {
      "type":"urgent",
      "message":"tester is testing"
   },
   {
      "type":"urgent",
      "message":"tester is testing"
   }
  ]
}

Result 2: Test passes 🆗 ..
i believe this is the correct one but in reality the tests allow both

{
   "total": 2,
   "data": [ 
   {
      "type":"urgent",
      "message":"tester is testing"
   },
   {
      "type":"urgent",
      "message":"tester is testing"
   } 
 ]
}
``

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions