mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +08:00
test: add test case
This commit is contained in:
parent
8f829546c5
commit
65b1e7c5a5
@ -17,6 +17,16 @@ describe('nocobase-admin-menu', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('migration', async () => {
|
test('migration', async () => {
|
||||||
|
await app.db.getRepository('collections').create({
|
||||||
|
values: {
|
||||||
|
autoGenId: true,
|
||||||
|
sortable: true,
|
||||||
|
name: 'bar',
|
||||||
|
template: 'general',
|
||||||
|
view: false,
|
||||||
|
},
|
||||||
|
context: {},
|
||||||
|
});
|
||||||
await app.db.getRepository('collections').create({
|
await app.db.getRepository('collections').create({
|
||||||
values: {
|
values: {
|
||||||
autoGenId: true,
|
autoGenId: true,
|
||||||
@ -37,7 +47,7 @@ describe('nocobase-admin-menu', () => {
|
|||||||
{
|
{
|
||||||
type: 'sort',
|
type: 'sort',
|
||||||
name: 'sort3',
|
name: 'sort3',
|
||||||
interface: 'sort3',
|
interface: 'sort',
|
||||||
uiSchema: {
|
uiSchema: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
title: 'Sort 3',
|
title: 'Sort 3',
|
||||||
@ -46,10 +56,18 @@ describe('nocobase-admin-menu', () => {
|
|||||||
'x-validator': 'integer',
|
'x-validator': 'integer',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'hasMany',
|
||||||
|
name: 'bar',
|
||||||
|
target: 'bar',
|
||||||
|
foreignKey: 'fooId',
|
||||||
|
sortable: true,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
context: {},
|
context: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
const migration = new Migration({
|
const migration = new Migration({
|
||||||
db: app.db,
|
db: app.db,
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -79,6 +97,15 @@ describe('nocobase-admin-menu', () => {
|
|||||||
name: 'sort3',
|
name: 'sort3',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
expect(sort3.interface).toBe('sort');
|
||||||
expect(sort3.get('uiSchema.title')).toBe('Sort 3');
|
expect(sort3.get('uiSchema.title')).toBe('Sort 3');
|
||||||
|
const sort4 = await app.db.getRepository('fields').findOne({
|
||||||
|
filter: {
|
||||||
|
collectionName: 'bar',
|
||||||
|
name: 'fooIdSort',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(sort4.interface).toBe('sort');
|
||||||
|
expect(sort4.get('uiSchema.title')).toBe('fooIdSort');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user