Files
directus/tests/e2e/api/ping.test.ts
Jay Cammarano 00a838f020 Docs for testing the API (#10275)
* mock-knex

* test on the migrations run started.

* test passing for run.up()

* reorganize /tests/ to allow integration tests

* e2e setup changes

* e2e jest.config moved

* e2e paths fixed, integration config

* add nonadmin role and user seed+migration

* auth/login w/ documentation (docs will be moved)

* update user seed

* add postgres10 to the ci?

* argon2 saves the day

* items tests passing with postgres10 support

* removed comments

* move generateHash out of directus_users

Co-authored-by: Jay Cammarano <jaycammarano@gmail.com>
2021-12-10 14:58:51 -05:00

38 lines
849 B
TypeScript

import request from 'supertest';
import config from '../config';
import { getDBsToTest } from '../get-dbs-to-test';
import knex, { Knex } from 'knex';
describe('/server', () => {
const databases = new Map<string, Knex>();
beforeAll(() => {
const vendors = getDBsToTest();
for (const vendor of vendors) {
databases.set(vendor, knex(config.knexConfig[vendor]!));
}
});
afterAll(() => {
for (const [_vendor, connection] of databases) {
connection.destroy();
}
});
describe('/ping', () => {
it.each(getDBsToTest())('%p', async (vendor) => {
// const knex = databases.get(vendor);
const url = `http://localhost:${config.ports[vendor]!}`;
const response = await request(url)
.get('/server/ping')
.expect('Content-Type', /text\/html/)
.expect(200);
expect(response.text).toBe('pong');
});
});
});