mirror of
https://github.com/directus/directus.git
synced 2026-01-29 14:07:57 -05:00
* Add "authenticate" filter hook that allows custom auth check * Start on test * Update Jest, restructure API tests, start implementing authenticate test * Move access token verify to util function * Ensure jest can show inline warnings on correct lines * Update is-directus-jwt to use jsonwebtoken decode + add tests * Remove unused package * Tweak and finish + test authenticate * Tweak test * Add authenticate filter to docs * Don't scan tests for codeql * No seriously, ignore tests
28 lines
733 B
TypeScript
28 lines
733 B
TypeScript
import knex, { Knex } from 'knex';
|
|
import { getTracker, MockClient, Tracker } from 'knex-mock-client';
|
|
import run from '../../../src/database/migrations/run';
|
|
|
|
describe('run', () => {
|
|
let db: jest.Mocked<Knex>;
|
|
let tracker: Tracker;
|
|
|
|
beforeAll(() => {
|
|
db = knex({ client: MockClient }) as jest.Mocked<Knex>;
|
|
tracker = getTracker();
|
|
});
|
|
|
|
afterEach(() => {
|
|
tracker.reset();
|
|
});
|
|
|
|
describe('when passed the argument up', () => {
|
|
it('returns "Nothing To Updage" if no directus_migrations', async () => {
|
|
tracker.on.select('directus_migrations').response(['Empty']);
|
|
await run(db, 'up').catch((e: Error) => {
|
|
expect(e).toBeInstanceOf(Error);
|
|
expect(e.message).toBe('Nothing to upgrade');
|
|
});
|
|
});
|
|
});
|
|
});
|