mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +08:00
fix(plugin-field-sort): fix build and test cases
This commit is contained in:
parent
845a6bd447
commit
d0dc0428fb
@ -16,6 +16,5 @@ export * from './add';
|
|||||||
export * from './set';
|
export * from './set';
|
||||||
export * from './remove';
|
export * from './remove';
|
||||||
export * from './toggle';
|
export * from './toggle';
|
||||||
export * from './move';
|
|
||||||
export * from './first-or-create';
|
export * from './first-or-create';
|
||||||
export * from './update-or-create';
|
export * from './update-or-create';
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
"@nocobase/cache": "1.4.0-alpha",
|
"@nocobase/cache": "1.4.0-alpha",
|
||||||
"@nocobase/database": "1.4.0-alpha",
|
"@nocobase/database": "1.4.0-alpha",
|
||||||
"@nocobase/resourcer": "1.4.0-alpha",
|
"@nocobase/resourcer": "1.4.0-alpha",
|
||||||
"@nocobase/test": "1.4.0-alpha",
|
|
||||||
"@nocobase/utils": "1.4.0-alpha",
|
"@nocobase/utils": "1.4.0-alpha",
|
||||||
"@types/jsonwebtoken": "^8.5.8",
|
"@types/jsonwebtoken": "^8.5.8",
|
||||||
"jsonwebtoken": "^8.5.1"
|
"jsonwebtoken": "^8.5.1"
|
||||||
|
@ -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);
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@nocobase/lock-manager",
|
"name": "@nocobase/lock-manager",
|
||||||
"version": "1.3.0-alpha",
|
"version": "1.4.0-alpha",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nocobase/utils": "1.3.0-alpha",
|
"@nocobase/utils": "1.4.0-alpha",
|
||||||
"async-mutex": "^0.5.0"
|
"async-mutex": "^0.5.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ import lodash from 'lodash';
|
|||||||
import { RecordableHistogram } from 'node:perf_hooks';
|
import { RecordableHistogram } from 'node:perf_hooks';
|
||||||
import path, { basename, resolve } from 'path';
|
import path, { basename, resolve } from 'path';
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
import packageJson from '../package.json';
|
|
||||||
import { createACL } from './acl';
|
import { createACL } from './acl';
|
||||||
import { AppCommand } from './app-command';
|
import { AppCommand } from './app-command';
|
||||||
import { AppSupervisor } from './app-supervisor';
|
import { AppSupervisor } from './app-supervisor';
|
||||||
@ -64,6 +63,8 @@ import { InstallOptions, PluginManager } from './plugin-manager';
|
|||||||
import { createPubSubManager, PubSubManager, PubSubManagerOptions } from './pub-sub-manager';
|
import { createPubSubManager, PubSubManager, PubSubManagerOptions } from './pub-sub-manager';
|
||||||
import { SyncMessageManager } from './sync-message-manager';
|
import { SyncMessageManager } from './sync-message-manager';
|
||||||
|
|
||||||
|
import packageJson from '../package.json';
|
||||||
|
|
||||||
export type PluginType = string | typeof Plugin;
|
export type PluginType = string | typeof Plugin;
|
||||||
export type PluginConfiguration = PluginType | [PluginType, any];
|
export type PluginConfiguration = PluginType | [PluginType, any];
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ export async function prepareApp(): Promise<MockServer> {
|
|||||||
plugins: [
|
plugins: [
|
||||||
'acl',
|
'acl',
|
||||||
'error-handler',
|
'error-handler',
|
||||||
|
'field-sort',
|
||||||
'users',
|
'users',
|
||||||
'ui-schema-storage',
|
'ui-schema-storage',
|
||||||
'data-source-main',
|
'data-source-main',
|
||||||
|
@ -20,7 +20,7 @@ describe('role', () => {
|
|||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
api = await createMockServer({
|
api = await createMockServer({
|
||||||
plugins: ['users', 'acl', 'auth', 'data-source-manager'],
|
plugins: ['field-sort', 'users', 'acl', 'auth', 'data-source-manager'],
|
||||||
});
|
});
|
||||||
db = api.db;
|
db = api.db;
|
||||||
usersPlugin = api.getPlugin('users');
|
usersPlugin = api.getPlugin('users');
|
||||||
|
@ -22,7 +22,7 @@ describe('actions', () => {
|
|||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
registerActions: true,
|
registerActions: true,
|
||||||
acl: 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;
|
db = app.db;
|
||||||
repo = db.getRepository('customRequests');
|
repo = db.getRepository('customRequests');
|
||||||
|
@ -32,7 +32,7 @@ describe('actions', () => {
|
|||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
registerActions: true,
|
registerActions: true,
|
||||||
acl: 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;
|
db = app.db;
|
||||||
|
@ -30,7 +30,7 @@ describe('signin', () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
app = await createMockServer({
|
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;
|
db = app.db;
|
||||||
agent = app.agent();
|
agent = app.agent();
|
||||||
|
@ -19,7 +19,7 @@ describe('actions', () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
plugins: ['auth'],
|
plugins: ['field-sort', 'auth'],
|
||||||
});
|
});
|
||||||
db = app.db;
|
db = app.db;
|
||||||
repo = db.getRepository('authenticators');
|
repo = db.getRepository('authenticators');
|
||||||
@ -95,7 +95,7 @@ describe('actions', () => {
|
|||||||
process.env.INIT_ROOT_PASSWORD = '123456';
|
process.env.INIT_ROOT_PASSWORD = '123456';
|
||||||
process.env.INIT_ROOT_NICKNAME = 'Test';
|
process.env.INIT_ROOT_NICKNAME = 'Test';
|
||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
plugins: ['auth', 'users'],
|
plugins: ['field-sort', 'auth', 'users'],
|
||||||
});
|
});
|
||||||
db = app.db;
|
db = app.db;
|
||||||
agent = app.agent();
|
agent = app.agent();
|
||||||
|
@ -18,7 +18,7 @@ describe('AuthModel', () => {
|
|||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
plugins: ['auth', 'users'],
|
plugins: ['field-sort', 'auth', 'users'],
|
||||||
});
|
});
|
||||||
db = app.db;
|
db = app.db;
|
||||||
repo = db.getRepository('authenticators');
|
repo = db.getRepository('authenticators');
|
||||||
|
@ -19,7 +19,7 @@ describe('auth', () => {
|
|||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
plugins: ['users', 'auth'],
|
plugins: ['field-sort', 'users', 'auth'],
|
||||||
});
|
});
|
||||||
db = app.db;
|
db = app.db;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ describe('token-blacklist', () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
plugins: ['auth'],
|
plugins: ['field-sort', 'auth'],
|
||||||
});
|
});
|
||||||
db = app.db;
|
db = app.db;
|
||||||
repo = db.getRepository('tokenBlacklist');
|
repo = db.getRepository('tokenBlacklist');
|
||||||
|
@ -18,7 +18,7 @@ describe('sql collection', () => {
|
|||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
app = await createMockServer({
|
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 = app.db;
|
||||||
db.options.underscored = false;
|
db.options.underscored = false;
|
||||||
|
@ -16,6 +16,7 @@ export async function prepareApp(): Promise<MockServer> {
|
|||||||
plugins: [
|
plugins: [
|
||||||
'acl',
|
'acl',
|
||||||
'error-handler',
|
'error-handler',
|
||||||
|
'field-sort',
|
||||||
'users',
|
'users',
|
||||||
'ui-schema-storage',
|
'ui-schema-storage',
|
||||||
'data-source-main',
|
'data-source-main',
|
||||||
@ -32,6 +33,7 @@ export async function createApp(options: any = {}) {
|
|||||||
acl: false,
|
acl: false,
|
||||||
...options,
|
...options,
|
||||||
plugins: [
|
plugins: [
|
||||||
|
'field-sort',
|
||||||
'data-source-main',
|
'data-source-main',
|
||||||
'users',
|
'users',
|
||||||
'collection-tree',
|
'collection-tree',
|
||||||
@ -47,7 +49,14 @@ export async function createAppWithNoUsersPlugin(options: any = {}) {
|
|||||||
const app = await createMockServer({
|
const app = await createMockServer({
|
||||||
acl: false,
|
acl: false,
|
||||||
...options,
|
...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;
|
return app;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ describe('tree collection sync', async () => {
|
|||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
version: '1.3.0-alpha',
|
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;
|
db = app.db;
|
||||||
});
|
});
|
||||||
@ -61,7 +61,7 @@ describe('collection tree migrate test', () => {
|
|||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
version: '1.3.0-alpha',
|
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;
|
db = app.db;
|
||||||
repo = app.db.getRepository('applicationPlugins');
|
repo = app.db.getRepository('applicationPlugins');
|
||||||
|
@ -42,7 +42,8 @@ describe('tree', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const userPlugin = app.getPlugin('users');
|
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('table_a', ['*']);
|
||||||
app.acl.allow('collections', ['*']);
|
app.acl.allow('collections', ['*']);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ describe('cluster', () => {
|
|||||||
let cluster;
|
let cluster;
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
cluster = await createMockCluster({
|
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,
|
acl: false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -16,7 +16,7 @@ describe('collections repository', () => {
|
|||||||
tablePrefix: 'through_',
|
tablePrefix: 'through_',
|
||||||
},
|
},
|
||||||
acl: false,
|
acl: false,
|
||||||
plugins: ['error-handler', 'data-source-main'],
|
plugins: ['error-handler', 'field-sort', 'data-source-main'],
|
||||||
});
|
});
|
||||||
|
|
||||||
await app1
|
await app1
|
||||||
@ -121,7 +121,7 @@ describe('collections repository', () => {
|
|||||||
await app1.destroy();
|
await app1.destroy();
|
||||||
|
|
||||||
const app2 = await startMockServer({
|
const app2 = await startMockServer({
|
||||||
plugins: ['error-handler', 'data-source-main'],
|
plugins: ['error-handler', 'field-sort', 'data-source-main'],
|
||||||
database: {
|
database: {
|
||||||
tablePrefix: 'through_',
|
tablePrefix: 'through_',
|
||||||
database: app1.db.options.database,
|
database: app1.db.options.database,
|
||||||
|
@ -20,7 +20,7 @@ describe('api', () => {
|
|||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
acl: true,
|
acl: true,
|
||||||
plugins: ['users', 'auth', 'data-visualization'],
|
plugins: ['field-sort', 'users', 'auth', 'data-visualization'],
|
||||||
});
|
});
|
||||||
db = app.db;
|
db = app.db;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ describe('external data source', () => {
|
|||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
process.env.INIT_ROOT_USERNAME = 'test';
|
process.env.INIT_ROOT_USERNAME = 'test';
|
||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
plugins: ['data-source-manager', 'users', 'acl'],
|
plugins: ['field-sort', 'data-source-manager', 'users', 'acl'],
|
||||||
});
|
});
|
||||||
db = app.db;
|
db = app.db;
|
||||||
ctx = {
|
ctx = {
|
||||||
|
@ -29,7 +29,7 @@ describe('query', () => {
|
|||||||
let db: Database;
|
let db: Database;
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
plugins: ['data-source-manager', 'users', 'acl'],
|
plugins: ['field-sort', 'data-source-manager', 'users', 'acl'],
|
||||||
});
|
});
|
||||||
db = app.db;
|
db = app.db;
|
||||||
db.options.underscored = true;
|
db.options.underscored = true;
|
||||||
|
@ -17,7 +17,7 @@ describe('belongs to array field', () => {
|
|||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
app = await createMockServer({
|
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;
|
db = app.db;
|
||||||
fieldRepo = db.getRepository('fields');
|
fieldRepo = db.getRepository('fields');
|
||||||
|
@ -17,7 +17,7 @@ describe('m2m array api, bigInt targetKey', () => {
|
|||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
app = await createMockServer({
|
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;
|
db = app.db;
|
||||||
await db.getRepository('collections').create({
|
await db.getRepository('collections').create({
|
||||||
|
@ -17,7 +17,7 @@ describe('m2m array api, string targetKey', () => {
|
|||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
app = await createMockServer({
|
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;
|
db = app.db;
|
||||||
await db.getRepository('collections').create({
|
await db.getRepository('collections').create({
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nocobase/plugin-field-sort",
|
"name": "@nocobase/plugin-field-sort",
|
||||||
"version": "1.3.0-alpha",
|
"version": "1.4.0-alpha",
|
||||||
"main": "dist/server/index.js",
|
"main": "dist/server/index.js",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
@ -7,22 +7,30 @@
|
|||||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { mockServer, MockServer } from './index';
|
import { createMockServer, MockServer } from '@nocobase/test';
|
||||||
import { registerActions } from '@nocobase/actions';
|
|
||||||
import { Collection, Database } from '@nocobase/database';
|
import { Collection, Database } from '@nocobase/database';
|
||||||
import { waitSecond } from '@nocobase/test';
|
import { waitSecond } from '@nocobase/test';
|
||||||
|
|
||||||
describe('sort action', () => {
|
import Plugin from '..';
|
||||||
describe('associations', () => {
|
|
||||||
let api: MockServer;
|
|
||||||
|
|
||||||
|
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;
|
let UserCollection: Collection;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
api = mockServer();
|
|
||||||
|
|
||||||
registerActions(api);
|
|
||||||
|
|
||||||
UserCollection = api.db.collection({
|
UserCollection = api.db.collection({
|
||||||
name: 'users',
|
name: 'users',
|
||||||
fields: [
|
fields: [
|
||||||
@ -67,10 +75,6 @@ describe('sort action', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
|
||||||
return api.destroy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not move association items when association not sortable', async () => {
|
it('should not move association items when association not sortable', async () => {
|
||||||
const u1 = await api.db.getRepository('users').findOne({
|
const u1 = await api.db.getRepository('users').findOne({
|
||||||
filter: {
|
filter: {
|
||||||
@ -143,7 +147,7 @@ describe('sort action', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(u1Posts.body).toMatchObject({
|
expect(u1Posts.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 'u1p2',
|
title: 'u1p2',
|
||||||
},
|
},
|
||||||
@ -162,12 +166,7 @@ describe('sort action', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('same scope', () => {
|
describe('same scope', () => {
|
||||||
let api: MockServer;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
api = mockServer();
|
|
||||||
|
|
||||||
registerActions(api);
|
|
||||||
api.db.collection({
|
api.db.collection({
|
||||||
name: 'tests',
|
name: 'tests',
|
||||||
fields: [
|
fields: [
|
||||||
@ -202,7 +201,7 @@ describe('sort action', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't2',
|
title: 't2',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
@ -237,7 +236,7 @@ describe('sort action', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't3',
|
title: 't3',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
@ -272,7 +271,7 @@ describe('sort action', () => {
|
|||||||
sort: ['sort2'],
|
sort: ['sort2'],
|
||||||
});
|
});
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't2',
|
title: 't2',
|
||||||
sort2: 1,
|
sort2: 1,
|
||||||
@ -306,7 +305,7 @@ describe('sort action', () => {
|
|||||||
sort: ['sort'],
|
sort: ['sort'],
|
||||||
});
|
});
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't3',
|
title: 't3',
|
||||||
sort: 0,
|
sort: 0,
|
||||||
@ -329,14 +328,9 @@ describe('sort action', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('different scope', () => {
|
describe('different scope', () => {
|
||||||
let api: MockServer;
|
|
||||||
let db: Database;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
api = mockServer();
|
|
||||||
db = api.db;
|
db = api.db;
|
||||||
|
|
||||||
registerActions(api);
|
|
||||||
api.db.collection({
|
api.db.collection({
|
||||||
name: 'tests',
|
name: 'tests',
|
||||||
fields: [
|
fields: [
|
||||||
@ -495,7 +489,7 @@ describe('sort action', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't12',
|
title: 't12',
|
||||||
sort: 2,
|
sort: 2,
|
||||||
@ -520,7 +514,7 @@ describe('sort action', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't21',
|
title: 't21',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
@ -561,7 +555,7 @@ describe('sort action', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't12',
|
title: 't12',
|
||||||
sort: 2,
|
sort: 2,
|
||||||
@ -584,7 +578,7 @@ describe('sort action', () => {
|
|||||||
filter: { state: 2 },
|
filter: { state: 2 },
|
||||||
});
|
});
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't21',
|
title: 't21',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
@ -622,7 +616,7 @@ describe('sort action', () => {
|
|||||||
filter: { state: 1 },
|
filter: { state: 1 },
|
||||||
});
|
});
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't11',
|
title: 't11',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
@ -653,7 +647,7 @@ describe('sort action', () => {
|
|||||||
filter: { state: 2 },
|
filter: { state: 2 },
|
||||||
});
|
});
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't21',
|
title: 't21',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
@ -684,7 +678,7 @@ describe('sort action', () => {
|
|||||||
filter: { state: 1 },
|
filter: { state: 1 },
|
||||||
});
|
});
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't11',
|
title: 't11',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
@ -715,7 +709,7 @@ describe('sort action', () => {
|
|||||||
filter: { state: 2 },
|
filter: { state: 2 },
|
||||||
});
|
});
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't21',
|
title: 't21',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
@ -750,7 +744,7 @@ describe('sort action', () => {
|
|||||||
filter: { state: 1 },
|
filter: { state: 1 },
|
||||||
});
|
});
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't12',
|
title: 't12',
|
||||||
sort: 2,
|
sort: 2,
|
||||||
@ -773,7 +767,7 @@ describe('sort action', () => {
|
|||||||
filter: { state: 2 },
|
filter: { state: 2 },
|
||||||
});
|
});
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't21',
|
title: 't21',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
@ -817,7 +811,7 @@ describe('sort action', () => {
|
|||||||
filter: { state: 1 },
|
filter: { state: 1 },
|
||||||
});
|
});
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't12',
|
title: 't12',
|
||||||
},
|
},
|
||||||
@ -837,7 +831,7 @@ describe('sort action', () => {
|
|||||||
filter: { state: 2 },
|
filter: { state: 2 },
|
||||||
});
|
});
|
||||||
expect(response.body).toMatchObject({
|
expect(response.body).toMatchObject({
|
||||||
rows: [
|
data: [
|
||||||
{
|
{
|
||||||
title: 't11',
|
title: 't11',
|
||||||
},
|
},
|
@ -7,16 +7,23 @@
|
|||||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { mockServer } from './index';
|
|
||||||
import { SortAbleCollection } from '../actions';
|
|
||||||
import lodash from 'lodash';
|
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', () => {
|
describe('sort collections', () => {
|
||||||
let app;
|
let app: MockServer;
|
||||||
|
let db: Database;
|
||||||
let Post;
|
let Post;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
app = mockServer();
|
app = await createMockServer({
|
||||||
|
plugins: ['error-handler', Plugin, 'data-source-main'],
|
||||||
|
});
|
||||||
|
|
||||||
|
db = app.db;
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
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 () => {
|
test('forward insert', async () => {
|
||||||
const t2 = await Post.repository.findOne({
|
const t2 = await Post.repository.findOne({
|
||||||
filter: {
|
filter: {
|
||||||
@ -62,7 +120,7 @@ describe('sort collections', () => {
|
|||||||
title: 't4',
|
title: 't4',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const sortCollection = new SortAbleCollection(Post);
|
const sortCollection = new SortableCollection(Post);
|
||||||
|
|
||||||
await sortCollection.move(t2.get('id'), t4.get('id'));
|
await sortCollection.move(t2.get('id'), t4.get('id'));
|
||||||
|
|
||||||
@ -95,7 +153,7 @@ describe('sort collections', () => {
|
|||||||
title: 't4',
|
title: 't4',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const sortCollection = new SortAbleCollection(Post);
|
const sortCollection = new SortableCollection(Post);
|
||||||
|
|
||||||
await sortCollection.move(t4.get('id'), t2.get('id'));
|
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'));
|
await sortCollection.move(s1t2.get('id'), s1t4.get('id'));
|
||||||
const results = (
|
const results = (
|
||||||
await Post.repository.find({
|
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'));
|
await sortCollection.move(s1t1.get('id'), s2t3.get('id'));
|
||||||
|
|
@ -7,23 +7,24 @@
|
|||||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Database, mockDatabase } from '@nocobase/database';
|
import { Database } from '@nocobase/database';
|
||||||
import { SortField } from '../sort-field';
|
import { createMockServer, MockServer } from '@nocobase/test';
|
||||||
|
|
||||||
|
import Plugin from '..';
|
||||||
|
|
||||||
describe('string field', () => {
|
describe('string field', () => {
|
||||||
|
let app: MockServer;
|
||||||
let db: Database;
|
let db: Database;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
db = mockDatabase();
|
app = await createMockServer({
|
||||||
await db.clean({ drop: true });
|
plugins: [Plugin, 'data-source-main', 'error-handler'],
|
||||||
|
|
||||||
db.registerFieldTypes({
|
|
||||||
sort: SortField,
|
|
||||||
});
|
});
|
||||||
|
db = app.db;
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
await db.close();
|
await app.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should init with camelCase scope key', async () => {
|
it('should init with camelCase scope key', async () => {
|
||||||
|
@ -36,21 +36,21 @@ export async function move(ctx: Context, next) {
|
|||||||
sortField = `${repository.association.foreignKey}Sort`;
|
sortField = `${repository.association.foreignKey}Sort`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortAbleCollection = new SortAbleCollection(repository.collection, sortField);
|
const sortableCollection = new SortableCollection(repository.collection, sortField);
|
||||||
|
|
||||||
if (sourceId && targetId) {
|
if (sourceId && targetId) {
|
||||||
await sortAbleCollection.move(sourceId, targetId, {
|
await sortableCollection.move(sourceId, targetId, {
|
||||||
insertAfter: method === 'insertAfter',
|
insertAfter: method === 'insertAfter',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// change scope
|
// change scope
|
||||||
if (sourceId && targetScope) {
|
if (sourceId && targetScope) {
|
||||||
await sortAbleCollection.changeScope(sourceId, targetScope, method);
|
await sortableCollection.changeScope(sourceId, targetScope, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sourceId && sticky) {
|
if (sourceId && sticky) {
|
||||||
await sortAbleCollection.sticky(sourceId);
|
await sortableCollection.sticky(sourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.body = 'ok';
|
ctx.body = 'ok';
|
||||||
@ -66,7 +66,7 @@ interface MoveOptions {
|
|||||||
insertAfter?: boolean;
|
insertAfter?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SortAbleCollection {
|
export class SortableCollection {
|
||||||
collection: Collection;
|
collection: Collection;
|
||||||
field: SortField;
|
field: SortField;
|
||||||
scopeKey: string;
|
scopeKey: string;
|
||||||
|
@ -18,7 +18,7 @@ export async function getApp(options = {}): Promise<MockServer> {
|
|||||||
cors: {
|
cors: {
|
||||||
origin: '*',
|
origin: '*',
|
||||||
},
|
},
|
||||||
plugins: ['users', 'auth', 'file-manager'],
|
plugins: ['field-sort', 'users', 'auth', 'file-manager'],
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(async (ctx, next) => {
|
app.use(async (ctx, next) => {
|
||||||
|
@ -22,6 +22,7 @@ describe('sync', () => {
|
|||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
plugins: [
|
plugins: [
|
||||||
// 'data-source-manager',
|
// 'data-source-manager',
|
||||||
|
'field-sort',
|
||||||
'data-source-main',
|
'data-source-main',
|
||||||
'localization',
|
'localization',
|
||||||
'ui-schema-storage',
|
'ui-schema-storage',
|
||||||
|
@ -44,7 +44,7 @@ describe('test with start', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const app = await createMockServer({
|
const app = await createMockServer({
|
||||||
plugins: ['multi-app-manager'],
|
plugins: ['field-sort', 'multi-app-manager'],
|
||||||
});
|
});
|
||||||
|
|
||||||
const db = app.db;
|
const db = app.db;
|
||||||
@ -74,7 +74,7 @@ describe('test with start', () => {
|
|||||||
|
|
||||||
it('should install into difference database', async () => {
|
it('should install into difference database', async () => {
|
||||||
const app = await createMockServer({
|
const app = await createMockServer({
|
||||||
plugins: ['multi-app-manager'],
|
plugins: ['field-sort', 'multi-app-manager'],
|
||||||
});
|
});
|
||||||
|
|
||||||
const db = app.db;
|
const db = app.db;
|
||||||
@ -85,7 +85,7 @@ describe('test with start', () => {
|
|||||||
values: {
|
values: {
|
||||||
name,
|
name,
|
||||||
options: {
|
options: {
|
||||||
plugins: ['ui-schema-storage'],
|
plugins: ['field-sort', 'ui-schema-storage'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
context: {
|
context: {
|
||||||
|
@ -13,7 +13,14 @@ export async function createApp(options = {}) {
|
|||||||
const app = await createMockServer({
|
const app = await createMockServer({
|
||||||
acl: false,
|
acl: false,
|
||||||
...options,
|
...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;
|
return app;
|
||||||
|
@ -16,7 +16,7 @@ describe('actions', () => {
|
|||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
registerActions: true,
|
registerActions: true,
|
||||||
acl: false,
|
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'],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ describe('actions', () => {
|
|||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
registerActions: true,
|
registerActions: true,
|
||||||
acl: false,
|
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'],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ describe('server hooks', () => {
|
|||||||
registerActions: true,
|
registerActions: true,
|
||||||
plugins: [
|
plugins: [
|
||||||
'ui-schema-storage',
|
'ui-schema-storage',
|
||||||
|
'field-sort',
|
||||||
'data-source-main',
|
'data-source-main',
|
||||||
'field-sort',
|
'field-sort',
|
||||||
'error-handler',
|
'error-handler',
|
||||||
|
@ -65,7 +65,7 @@ describe('server hooks', () => {
|
|||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
registerActions: true,
|
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;
|
db = app.db;
|
||||||
|
@ -23,7 +23,7 @@ describe('actions', () => {
|
|||||||
process.env.INIT_ROOT_PASSWORD = '123456';
|
process.env.INIT_ROOT_PASSWORD = '123456';
|
||||||
process.env.INIT_ROOT_NICKNAME = 'Test';
|
process.env.INIT_ROOT_NICKNAME = 'Test';
|
||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
plugins: ['auth', 'users', 'acl', 'data-source-manager'],
|
plugins: ['field-sort', 'auth', 'users', 'acl', 'data-source-manager'],
|
||||||
});
|
});
|
||||||
db = app.db;
|
db = app.db;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ describe('createdBy/updatedBy', () => {
|
|||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
api = await createMockServer({
|
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;
|
db = api.db;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ describe('models', () => {
|
|||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
plugins: ['auth', 'users'],
|
plugins: ['field-sort', 'auth', 'users'],
|
||||||
});
|
});
|
||||||
db = app.db;
|
db = app.db;
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,7 @@ describe('actions', () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
app = await createMockServer({
|
app = await createMockServer({
|
||||||
plugins: ['acl', 'users', 'data-source-manager'],
|
plugins: ['acl', 'field-sort', 'users', 'data-source-manager'],
|
||||||
});
|
});
|
||||||
db = app.db;
|
db = app.db;
|
||||||
repo = db.getRepository('users');
|
repo = db.getRepository('users');
|
||||||
|
@ -43,6 +43,7 @@ export async function getApp({
|
|||||||
const app = await createMockServer({
|
const app = await createMockServer({
|
||||||
...options,
|
...options,
|
||||||
plugins: [
|
plugins: [
|
||||||
|
'field-sort',
|
||||||
[
|
[
|
||||||
'workflow',
|
'workflow',
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user