fix(plugin-field-sort): fix build and test cases

This commit is contained in:
mytharcher 2024-08-26 21:46:13 +08:00
parent 845a6bd447
commit d0dc0428fb
44 changed files with 175 additions and 177 deletions

View File

@ -16,6 +16,5 @@ export * from './add';
export * from './set';
export * from './remove';
export * from './toggle';
export * from './move';
export * from './first-or-create';
export * from './update-or-create';

View File

@ -10,7 +10,6 @@
"@nocobase/cache": "1.4.0-alpha",
"@nocobase/database": "1.4.0-alpha",
"@nocobase/resourcer": "1.4.0-alpha",
"@nocobase/test": "1.4.0-alpha",
"@nocobase/utils": "1.4.0-alpha",
"@types/jsonwebtoken": "^8.5.8",
"jsonwebtoken": "^8.5.1"

View File

@ -1,75 +0,0 @@
/**
* This file is part of the NocoBase (R) project.
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
* Authors: NocoBase Team.
*
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import { mockDatabase } from './index';
import { Database } from '../database';
describe('collection sortable options', () => {
let db: Database;
beforeEach(async () => {
db = mockDatabase();
await db.clean({ drop: true });
});
afterEach(async () => {
await db.close();
});
test('sortable=true', async () => {
const Test = db.collection({
name: 'test',
sortable: true,
});
const model = Test.model;
await db.sync();
const instance = await model.create();
expect(model.rawAttributes['sort']).toBeDefined();
expect(instance.get('sort')).toBe(1);
});
test('sortable=string', async () => {
const Test = db.collection({
name: 'test',
sortable: 'order',
});
const model = Test.model;
await db.sync();
const instance = await model.create();
expect(model.rawAttributes['order']).toBeDefined();
expect(instance.get('order')).toBe(1);
});
test('sortable=object', async () => {
const Test = db.collection({
name: 'test',
sortable: {
name: 'sort',
scopeKey: 'status',
},
fields: [{ type: 'string', name: 'status' }],
});
await db.sync();
const t1 = await Test.model.create({ status: 'publish' });
const t2 = await Test.model.create({ status: 'publish' });
const t3 = await Test.model.create({ status: 'draft' });
const t4 = await Test.model.create({ status: 'draft' });
expect(t1.get('sort')).toBe(1);
expect(t2.get('sort')).toBe(2);
expect(t3.get('sort')).toBe(1);
expect(t4.get('sort')).toBe(2);
});
});

View File

@ -1,12 +1,12 @@
{
"name": "@nocobase/lock-manager",
"version": "1.3.0-alpha",
"version": "1.4.0-alpha",
"main": "lib/index.js",
"license": "AGPL-3.0",
"dependencies": {
},
"devDependencies": {
"@nocobase/utils": "1.3.0-alpha",
"@nocobase/utils": "1.4.0-alpha",
"async-mutex": "^0.5.0"
}
}

View File

@ -37,7 +37,6 @@ import lodash from 'lodash';
import { RecordableHistogram } from 'node:perf_hooks';
import path, { basename, resolve } from 'path';
import semver from 'semver';
import packageJson from '../package.json';
import { createACL } from './acl';
import { AppCommand } from './app-command';
import { AppSupervisor } from './app-supervisor';
@ -64,6 +63,8 @@ import { InstallOptions, PluginManager } from './plugin-manager';
import { createPubSubManager, PubSubManager, PubSubManagerOptions } from './pub-sub-manager';
import { SyncMessageManager } from './sync-message-manager';
import packageJson from '../package.json';
export type PluginType = string | typeof Plugin;
export type PluginConfiguration = PluginType | [PluginType, any];

View File

@ -16,6 +16,7 @@ export async function prepareApp(): Promise<MockServer> {
plugins: [
'acl',
'error-handler',
'field-sort',
'users',
'ui-schema-storage',
'data-source-main',

View File

@ -20,7 +20,7 @@ describe('role', () => {
beforeEach(async () => {
api = await createMockServer({
plugins: ['users', 'acl', 'auth', 'data-source-manager'],
plugins: ['field-sort', 'users', 'acl', 'auth', 'data-source-manager'],
});
db = api.db;
usersPlugin = api.getPlugin('users');

View File

@ -22,7 +22,7 @@ describe('actions', () => {
app = await createMockServer({
registerActions: true,
acl: true,
plugins: ['users', 'auth', 'acl', 'action-custom-request', 'data-source-manager'],
plugins: ['field-sort', 'users', 'auth', 'acl', 'action-custom-request', 'data-source-manager'],
});
db = app.db;
repo = db.getRepository('customRequests');

View File

@ -32,7 +32,7 @@ describe('actions', () => {
app = await createMockServer({
registerActions: true,
acl: true,
plugins: ['users', 'auth', 'api-keys', 'acl', 'data-source-manager'],
plugins: ['field-sort', 'users', 'auth', 'api-keys', 'acl', 'data-source-manager'],
});
db = app.db;

View File

@ -30,7 +30,7 @@ describe('signin', () => {
beforeAll(async () => {
app = await createMockServer({
plugins: ['users', 'auth', 'verification', 'acl', 'auth-sms', 'data-source-manager'],
plugins: ['field-sort', 'users', 'auth', 'verification', 'acl', 'auth-sms', 'data-source-manager'],
});
db = app.db;
agent = app.agent();

View File

@ -19,7 +19,7 @@ describe('actions', () => {
beforeAll(async () => {
app = await createMockServer({
plugins: ['auth'],
plugins: ['field-sort', 'auth'],
});
db = app.db;
repo = db.getRepository('authenticators');
@ -95,7 +95,7 @@ describe('actions', () => {
process.env.INIT_ROOT_PASSWORD = '123456';
process.env.INIT_ROOT_NICKNAME = 'Test';
app = await createMockServer({
plugins: ['auth', 'users'],
plugins: ['field-sort', 'auth', 'users'],
});
db = app.db;
agent = app.agent();

View File

@ -18,7 +18,7 @@ describe('AuthModel', () => {
beforeEach(async () => {
app = await createMockServer({
plugins: ['auth', 'users'],
plugins: ['field-sort', 'auth', 'users'],
});
db = app.db;
repo = db.getRepository('authenticators');

View File

@ -19,7 +19,7 @@ describe('auth', () => {
beforeEach(async () => {
app = await createMockServer({
plugins: ['users', 'auth'],
plugins: ['field-sort', 'users', 'auth'],
});
db = app.db;

View File

@ -19,7 +19,7 @@ describe('token-blacklist', () => {
beforeAll(async () => {
app = await createMockServer({
plugins: ['auth'],
plugins: ['field-sort', 'auth'],
});
db = app.db;
repo = db.getRepository('tokenBlacklist');

View File

@ -18,7 +18,7 @@ describe('sql collection', () => {
beforeEach(async () => {
app = await createMockServer({
plugins: ['data-source-main', 'error-handler', 'collection-sql'],
plugins: ['field-sort', 'data-source-main', 'error-handler', 'collection-sql'],
});
db = app.db;
db.options.underscored = false;

View File

@ -16,6 +16,7 @@ export async function prepareApp(): Promise<MockServer> {
plugins: [
'acl',
'error-handler',
'field-sort',
'users',
'ui-schema-storage',
'data-source-main',
@ -32,6 +33,7 @@ export async function createApp(options: any = {}) {
acl: false,
...options,
plugins: [
'field-sort',
'data-source-main',
'users',
'collection-tree',
@ -47,7 +49,14 @@ export async function createAppWithNoUsersPlugin(options: any = {}) {
const app = await createMockServer({
acl: false,
...options,
plugins: ['data-source-main', 'collection-tree', 'error-handler', 'data-source-manager', 'ui-schema-storage'],
plugins: [
'field-sort',
'data-source-main',
'collection-tree',
'error-handler',
'data-source-manager',
'ui-schema-storage',
],
});
return app;
}

View File

@ -18,7 +18,7 @@ describe('tree collection sync', async () => {
beforeEach(async () => {
app = await createMockServer({
version: '1.3.0-alpha',
plugins: ['data-source-main', 'data-source-manager', 'error-handler', 'collection-tree'],
plugins: ['field-sort', 'data-source-main', 'data-source-manager', 'error-handler', 'collection-tree'],
});
db = app.db;
});
@ -61,7 +61,7 @@ describe('collection tree migrate test', () => {
beforeEach(async () => {
app = await createMockServer({
version: '1.3.0-alpha',
plugins: ['data-source-main', 'data-source-manager', 'error-handler', 'collection-tree'],
plugins: ['field-sort', 'data-source-main', 'data-source-manager', 'error-handler', 'collection-tree'],
});
db = app.db;
repo = app.db.getRepository('applicationPlugins');

View File

@ -42,7 +42,8 @@ describe('tree', () => {
});
const userPlugin = app.getPlugin('users');
const agent = app.agent().login(user).set('X-With-ACL-Meta', true);
const agent = app.agent().login(user);
agent.set('X-With-ACL-Meta', 'true');
app.acl.allow('table_a', ['*']);
app.acl.allow('collections', ['*']);

View File

@ -13,7 +13,7 @@ describe('cluster', () => {
let cluster;
beforeEach(async () => {
cluster = await createMockCluster({
plugins: ['error-handler', 'data-source-main', 'ui-schema-storage'],
plugins: ['error-handler', 'field-sort', 'data-source-main', 'ui-schema-storage'],
acl: false,
});
});

View File

@ -16,7 +16,7 @@ describe('collections repository', () => {
tablePrefix: 'through_',
},
acl: false,
plugins: ['error-handler', 'data-source-main'],
plugins: ['error-handler', 'field-sort', 'data-source-main'],
});
await app1
@ -121,7 +121,7 @@ describe('collections repository', () => {
await app1.destroy();
const app2 = await startMockServer({
plugins: ['error-handler', 'data-source-main'],
plugins: ['error-handler', 'field-sort', 'data-source-main'],
database: {
tablePrefix: 'through_',
database: app1.db.options.database,

View File

@ -20,7 +20,7 @@ describe('api', () => {
beforeAll(async () => {
app = await createMockServer({
acl: true,
plugins: ['users', 'auth', 'data-visualization'],
plugins: ['field-sort', 'users', 'auth', 'data-visualization'],
});
db = app.db;

View File

@ -19,7 +19,7 @@ describe('external data source', () => {
beforeAll(async () => {
process.env.INIT_ROOT_USERNAME = 'test';
app = await createMockServer({
plugins: ['data-source-manager', 'users', 'acl'],
plugins: ['field-sort', 'data-source-manager', 'users', 'acl'],
});
db = app.db;
ctx = {

View File

@ -29,7 +29,7 @@ describe('query', () => {
let db: Database;
beforeAll(async () => {
app = await createMockServer({
plugins: ['data-source-manager', 'users', 'acl'],
plugins: ['field-sort', 'data-source-manager', 'users', 'acl'],
});
db = app.db;
db.options.underscored = true;

View File

@ -17,7 +17,7 @@ describe('belongs to array field', () => {
beforeEach(async () => {
app = await createMockServer({
plugins: ['field-m2m-array', 'data-source-manager', 'data-source-main', 'error-handler'],
plugins: ['field-m2m-array', 'data-source-manager', 'field-sort', 'data-source-main', 'error-handler'],
});
db = app.db;
fieldRepo = db.getRepository('fields');

View File

@ -17,7 +17,7 @@ describe('m2m array api, bigInt targetKey', () => {
beforeEach(async () => {
app = await createMockServer({
plugins: ['field-m2m-array', 'data-source-manager', 'data-source-main', 'error-handler'],
plugins: ['field-m2m-array', 'data-source-manager', 'field-sort', 'data-source-main', 'error-handler'],
});
db = app.db;
await db.getRepository('collections').create({

View File

@ -17,7 +17,7 @@ describe('m2m array api, string targetKey', () => {
beforeEach(async () => {
app = await createMockServer({
plugins: ['field-m2m-array', 'data-source-manager', 'data-source-main', 'error-handler'],
plugins: ['field-m2m-array', 'data-source-manager', 'field-sort', 'data-source-main', 'error-handler'],
});
db = app.db;
await db.getRepository('collections').create({

View File

@ -1,6 +1,6 @@
{
"name": "@nocobase/plugin-field-sort",
"version": "1.3.0-alpha",
"version": "1.4.0-alpha",
"main": "dist/server/index.js",
"dependencies": {},
"peerDependencies": {

View File

@ -7,22 +7,30 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import { mockServer, MockServer } from './index';
import { registerActions } from '@nocobase/actions';
import { createMockServer, MockServer } from '@nocobase/test';
import { Collection, Database } from '@nocobase/database';
import { waitSecond } from '@nocobase/test';
describe('sort action', () => {
describe('associations', () => {
let api: MockServer;
import Plugin from '..';
describe('sort action', () => {
let api: MockServer;
let db: Database;
beforeEach(async () => {
api = await createMockServer({
plugins: [Plugin, 'data-source-main', 'error-handler'],
});
});
afterEach(async () => {
return api.destroy();
});
describe('associations', () => {
let UserCollection: Collection;
beforeEach(async () => {
api = mockServer();
registerActions(api);
UserCollection = api.db.collection({
name: 'users',
fields: [
@ -67,10 +75,6 @@ describe('sort action', () => {
}
});
afterEach(async () => {
return api.destroy();
});
it('should not move association items when association not sortable', async () => {
const u1 = await api.db.getRepository('users').findOne({
filter: {
@ -143,7 +147,7 @@ describe('sort action', () => {
});
expect(u1Posts.body).toMatchObject({
rows: [
data: [
{
title: 'u1p2',
},
@ -162,12 +166,7 @@ describe('sort action', () => {
});
describe('same scope', () => {
let api: MockServer;
beforeEach(async () => {
api = mockServer();
registerActions(api);
api.db.collection({
name: 'tests',
fields: [
@ -202,7 +201,7 @@ describe('sort action', () => {
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't2',
sort: 1,
@ -237,7 +236,7 @@ describe('sort action', () => {
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't3',
sort: 1,
@ -272,7 +271,7 @@ describe('sort action', () => {
sort: ['sort2'],
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't2',
sort2: 1,
@ -306,7 +305,7 @@ describe('sort action', () => {
sort: ['sort'],
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't3',
sort: 0,
@ -329,14 +328,9 @@ describe('sort action', () => {
});
describe('different scope', () => {
let api: MockServer;
let db: Database;
beforeEach(async () => {
api = mockServer();
db = api.db;
registerActions(api);
api.db.collection({
name: 'tests',
fields: [
@ -495,7 +489,7 @@ describe('sort action', () => {
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't12',
sort: 2,
@ -520,7 +514,7 @@ describe('sort action', () => {
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't21',
sort: 1,
@ -561,7 +555,7 @@ describe('sort action', () => {
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't12',
sort: 2,
@ -584,7 +578,7 @@ describe('sort action', () => {
filter: { state: 2 },
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't21',
sort: 1,
@ -622,7 +616,7 @@ describe('sort action', () => {
filter: { state: 1 },
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't11',
sort: 1,
@ -653,7 +647,7 @@ describe('sort action', () => {
filter: { state: 2 },
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't21',
sort: 1,
@ -684,7 +678,7 @@ describe('sort action', () => {
filter: { state: 1 },
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't11',
sort: 1,
@ -715,7 +709,7 @@ describe('sort action', () => {
filter: { state: 2 },
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't21',
sort: 1,
@ -750,7 +744,7 @@ describe('sort action', () => {
filter: { state: 1 },
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't12',
sort: 2,
@ -773,7 +767,7 @@ describe('sort action', () => {
filter: { state: 2 },
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't21',
sort: 1,
@ -817,7 +811,7 @@ describe('sort action', () => {
filter: { state: 1 },
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't12',
},
@ -837,7 +831,7 @@ describe('sort action', () => {
filter: { state: 2 },
});
expect(response.body).toMatchObject({
rows: [
data: [
{
title: 't11',
},

View File

@ -7,16 +7,23 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import { mockServer } from './index';
import { SortAbleCollection } from '../actions';
import lodash from 'lodash';
import Database from '@nocobase/database';
import { createMockServer, MockServer } from '@nocobase/test';
import { SortableCollection } from '../action';
import Plugin from '..';
describe('sort collections', () => {
let app;
let app: MockServer;
let db: Database;
let Post;
beforeEach(async () => {
app = mockServer();
app = await createMockServer({
plugins: ['error-handler', Plugin, 'data-source-main'],
});
db = app.db;
});
afterEach(async () => {
@ -50,6 +57,57 @@ describe('sort collections', () => {
}
});
test('sortable=true', async () => {
const Test = db.collection({
name: 'test',
sortable: true,
});
const model = Test.model;
await db.sync();
const instance = await model.create();
expect(model.rawAttributes['sort']).toBeDefined();
expect(instance.get('sort')).toBe(1);
});
test('sortable=string', async () => {
const Test = db.collection({
name: 'test',
sortable: 'order',
});
const model = Test.model;
await db.sync();
const instance = await model.create();
expect(model.rawAttributes['order']).toBeDefined();
expect(instance.get('order')).toBe(1);
});
test('sortable=object', async () => {
const Test = db.collection({
name: 'test',
sortable: {
name: 'sort',
scopeKey: 'status',
},
fields: [{ type: 'string', name: 'status' }],
});
await db.sync();
const t1 = await Test.model.create({ status: 'publish' });
const t2 = await Test.model.create({ status: 'publish' });
const t3 = await Test.model.create({ status: 'draft' });
const t4 = await Test.model.create({ status: 'draft' });
expect(t1.get('sort')).toBe(1);
expect(t2.get('sort')).toBe(2);
expect(t3.get('sort')).toBe(1);
expect(t4.get('sort')).toBe(2);
});
test('forward insert', async () => {
const t2 = await Post.repository.findOne({
filter: {
@ -62,7 +120,7 @@ describe('sort collections', () => {
title: 't4',
},
});
const sortCollection = new SortAbleCollection(Post);
const sortCollection = new SortableCollection(Post);
await sortCollection.move(t2.get('id'), t4.get('id'));
@ -95,7 +153,7 @@ describe('sort collections', () => {
title: 't4',
},
});
const sortCollection = new SortAbleCollection(Post);
const sortCollection = new SortableCollection(Post);
await sortCollection.move(t4.get('id'), t2.get('id'));
@ -173,7 +231,7 @@ describe('sort collections', () => {
},
});
const sortCollection = new SortAbleCollection(Post);
const sortCollection = new SortableCollection(Post);
await sortCollection.move(s1t2.get('id'), s1t4.get('id'));
const results = (
await Post.repository.find({
@ -245,7 +303,7 @@ describe('sort collections', () => {
},
});
const sortCollection = new SortAbleCollection(Post);
const sortCollection = new SortableCollection(Post);
await sortCollection.move(s1t1.get('id'), s2t3.get('id'));

View File

@ -7,23 +7,24 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import { Database, mockDatabase } from '@nocobase/database';
import { SortField } from '../sort-field';
import { Database } from '@nocobase/database';
import { createMockServer, MockServer } from '@nocobase/test';
import Plugin from '..';
describe('string field', () => {
let app: MockServer;
let db: Database;
beforeEach(async () => {
db = mockDatabase();
await db.clean({ drop: true });
db.registerFieldTypes({
sort: SortField,
app = await createMockServer({
plugins: [Plugin, 'data-source-main', 'error-handler'],
});
db = app.db;
});
afterEach(async () => {
await db.close();
await app.destroy();
});
it('should init with camelCase scope key', async () => {

View File

@ -36,21 +36,21 @@ export async function move(ctx: Context, next) {
sortField = `${repository.association.foreignKey}Sort`;
}
const sortAbleCollection = new SortAbleCollection(repository.collection, sortField);
const sortableCollection = new SortableCollection(repository.collection, sortField);
if (sourceId && targetId) {
await sortAbleCollection.move(sourceId, targetId, {
await sortableCollection.move(sourceId, targetId, {
insertAfter: method === 'insertAfter',
});
}
// change scope
if (sourceId && targetScope) {
await sortAbleCollection.changeScope(sourceId, targetScope, method);
await sortableCollection.changeScope(sourceId, targetScope, method);
}
if (sourceId && sticky) {
await sortAbleCollection.sticky(sourceId);
await sortableCollection.sticky(sourceId);
}
ctx.body = 'ok';
@ -66,7 +66,7 @@ interface MoveOptions {
insertAfter?: boolean;
}
export class SortAbleCollection {
export class SortableCollection {
collection: Collection;
field: SortField;
scopeKey: string;

View File

@ -18,7 +18,7 @@ export async function getApp(options = {}): Promise<MockServer> {
cors: {
origin: '*',
},
plugins: ['users', 'auth', 'file-manager'],
plugins: ['field-sort', 'users', 'auth', 'file-manager'],
});
app.use(async (ctx, next) => {

View File

@ -22,6 +22,7 @@ describe('sync', () => {
app = await createMockServer({
plugins: [
// 'data-source-manager',
'field-sort',
'data-source-main',
'localization',
'ui-schema-storage',

View File

@ -44,7 +44,7 @@ describe('test with start', () => {
};
const app = await createMockServer({
plugins: ['multi-app-manager'],
plugins: ['field-sort', 'multi-app-manager'],
});
const db = app.db;
@ -74,7 +74,7 @@ describe('test with start', () => {
it('should install into difference database', async () => {
const app = await createMockServer({
plugins: ['multi-app-manager'],
plugins: ['field-sort', 'multi-app-manager'],
});
const db = app.db;
@ -85,7 +85,7 @@ describe('test with start', () => {
values: {
name,
options: {
plugins: ['ui-schema-storage'],
plugins: ['field-sort', 'ui-schema-storage'],
},
},
context: {

View File

@ -13,7 +13,14 @@ export async function createApp(options = {}) {
const app = await createMockServer({
acl: false,
...options,
plugins: ['users', 'error-handler', 'data-source-main', 'multi-app-manager', 'multi-app-share-collection'],
plugins: [
'field-sort',
'users',
'error-handler',
'data-source-main',
'multi-app-manager',
'multi-app-share-collection',
],
});
return app;

View File

@ -16,7 +16,7 @@ describe('actions', () => {
app = await createMockServer({
registerActions: true,
acl: false,
plugins: ['error-handler', 'users', 'ui-schema-storage', 'data-source-main', 'snapshot-field'],
plugins: ['error-handler', 'field-sort', 'users', 'ui-schema-storage', 'data-source-main', 'snapshot-field'],
});
});

View File

@ -27,7 +27,7 @@ describe('actions', () => {
app = await createMockServer({
registerActions: true,
acl: false,
plugins: ['error-handler', 'users', 'ui-schema-storage', 'data-source-main', 'snapshot-field'],
plugins: ['error-handler', 'field-sort', 'users', 'ui-schema-storage', 'data-source-main', 'snapshot-field'],
});
});

View File

@ -26,6 +26,7 @@ describe('server hooks', () => {
registerActions: true,
plugins: [
'ui-schema-storage',
'field-sort',
'data-source-main',
'field-sort',
'error-handler',

View File

@ -65,7 +65,7 @@ describe('server hooks', () => {
beforeEach(async () => {
app = await createMockServer({
registerActions: true,
plugins: ['ui-schema-storage', 'data-source-main', 'error-handler'],
plugins: ['ui-schema-storage', 'field-sort', 'data-source-main', 'error-handler'],
});
db = app.db;

View File

@ -23,7 +23,7 @@ describe('actions', () => {
process.env.INIT_ROOT_PASSWORD = '123456';
process.env.INIT_ROOT_NICKNAME = 'Test';
app = await createMockServer({
plugins: ['auth', 'users', 'acl', 'data-source-manager'],
plugins: ['field-sort', 'auth', 'users', 'acl', 'data-source-manager'],
});
db = app.db;

View File

@ -18,7 +18,7 @@ describe('createdBy/updatedBy', () => {
beforeEach(async () => {
api = await createMockServer({
plugins: ['acl', 'users', 'data-source-main', 'error-handler', 'data-source-manager'],
plugins: ['acl', 'field-sort', 'users', 'data-source-main', 'error-handler', 'data-source-manager'],
});
db = api.db;

View File

@ -17,7 +17,7 @@ describe('models', () => {
beforeEach(async () => {
app = await createMockServer({
plugins: ['auth', 'users'],
plugins: ['field-sort', 'auth', 'users'],
});
db = app.db;
});

View File

@ -18,7 +18,7 @@ describe('actions', () => {
beforeAll(async () => {
app = await createMockServer({
plugins: ['acl', 'users', 'data-source-manager'],
plugins: ['acl', 'field-sort', 'users', 'data-source-manager'],
});
db = app.db;
repo = db.getRepository('users');

View File

@ -43,6 +43,7 @@ export async function getApp({
const app = await createMockServer({
...options,
plugins: [
'field-sort',
[
'workflow',
{