Files
directus/tests
ian 443d3f6734 Add depth limit to filtering (#11845)
* Add depth limit to filtering

* Add depth limit to GraphQL

* Add docs

* Rename environment variable

* Add simple deep filter depth calculation

* Update error message

* Shift fields depth check to base function

* Remove unused var

* Implement GraphQL filter depth

* Add check for _and & _or filters in GraphQL

* Add check for _and & _or filters in REST

* Remove commented code

* Add check for REST filter query

* Add REST tests

* Setup m2m using directus fields

* Add GraphQL tests

* Fix linter error

* Cleanup calculateDepth + add docs/tests

* Remove validator in GraphQL

* Add depth checking for nested sort

* Enable source map to display correct error lines

* Set max relational depth to be at least 2

* Update tests

* Add unit test for deep _sort

* Add minimum value in docs

* Refactor depth validation to be in validateQuery

* Add boolean parameter for calculation of _sort in deep query

* Use array of keys to parse dot notation

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-06-15 11:52:54 -04:00
..
2022-06-15 11:52:54 -04:00
2022-05-02 13:16:03 -04:00
2022-01-25 21:37:39 +00:00

E2E tests

Setup

Make sure the containers for the databases are running by running docker compose up -d in this folder.

Running tests locally

Run npm run test:e2e to run the e2e tests for every supported database vendor.

Testing a specific database

Provide a csv of database drivers in the TEST_DB environment variable to test specific databases:

TEST_DB=cockroachdb npm run test:e2e

Using an existing Directus instance

The test suite will spin up a fresh copy of the Directus API from the current build. To use an already running copy of Directus, set the TEST_LOCAL flag:

TEST_DB=cockroachdb TEST_LOCAL=true npm run test:e2e

This will use localhost:8055 as the URL for every test. Note: make sure to connect your local Directus database instance to the test database container found in docker-compose in this folder.

Watching for (test) changes

Use npm run test:e2e:watch to enable Jest's --watch mode, especially useful in combination with the flags above.

This does not watch changes to Directus; it only watches changes to the tests.