Files
directus/api/tests/__test-utils__/schemas.ts
Jay Cammarano ef9b30c0e1 Integration tests set up and examples (#10419)
* tsconfig loosened to match api

* integration test folder and script

* .env mock isn't needed

* mock-env, locations of tests

* I was wrong.

* Updated progress

* schemas => getSchema(), exported getColumnPreprocessor()

* change imports to allow build

* add MockClient as DB Client (should mock getDBClient())

* move authservice into. not used elsewhere

* test passing

* remove unneeded test for this PR

* removed unneded fields from rawItem

* formatting

* createOne test passing

* typo

* removed int specific jest.config

* use systemSchema over getSchema()

* this.knex over getDatabase()

* mock getDatabaseClient

* removed unused mock-env

* formatting

* removed unused collections from schema

* response => responseOnce

* more direct

* unused var

* more tests please!

* test for: createOne no permissions

* removed broken test for now

* clean up

* readOne tests what does into db and returned

* added bindings check

* added into db sql check

* moved tests outside src

* changed ts config

* cli test location changed

* removed looking for tests in src

* readding it for e2e tests? Seems fishy

* Integration tests for ItemsService user tables (#11208)

* renamed ItemsService test to match src file name

* add user table schema

* system/user tables use .each, formatting needed

* format system and user better in title

* tables/table=> schemas/schema

* filter _eq test passing

* comment for later and formatting

* everything in it's right place

* future proofing as more fields are added

* removed duplicate test

* formatting

* readMany() filter: _or

Co-authored-by: Jay Cammarano <jaycammarano@gmail.com>

* added knex check before getDatabase()

* Move util test to tests folder

Co-authored-by: Jay Cammarano <jaycammarano@gmail.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-01-24 19:55:08 +00:00

86 lines
1.6 KiB
TypeScript

import { CollectionsOverview, Relation } from '@directus/shared/types';
export const systemSchema = {
collections: {
directus_users: {
collection: 'directus_users',
primary: 'id',
singleton: false,
note: '$t:directus_collection.directus_users',
sortField: null,
accountability: null,
fields: {
id: {
field: 'id',
defaultValue: null,
nullable: false,
generated: false,
type: 'uuid',
dbType: 'uuid',
precision: null,
scale: null,
special: [],
note: null,
alias: false,
},
name: {
field: 'name',
defaultValue: "A User's Name",
nullable: false,
generated: false,
type: 'uuid',
dbType: 'uuid',
precision: null,
scale: null,
special: [],
note: null,
alias: false,
},
},
},
} as CollectionsOverview,
relations: [] as Relation[],
};
export const userSchema = {
collections: {
authors: {
collection: 'authors',
primary: 'id',
singleton: false,
note: 'authors',
sortField: null,
accountability: null,
fields: {
id: {
field: 'id',
defaultValue: null,
nullable: false,
generated: false,
type: 'uuid',
dbType: 'uuid',
precision: null,
scale: null,
special: [],
note: null,
alias: false,
},
name: {
field: 'name',
defaultValue: "An Author's Name",
nullable: false,
generated: false,
type: 'uuid',
dbType: 'uuid',
precision: null,
scale: null,
special: [],
note: null,
alias: false,
},
},
},
} as CollectionsOverview,
relations: [] as Relation[],
};