fix: inherited collection test

This commit is contained in:
Chareice 2023-02-15 17:08:35 +08:00
parent d232a7bb50
commit 897cede160
2 changed files with 54 additions and 50 deletions

View File

@ -3,56 +3,6 @@ import Application from '@nocobase/server';
import { createApp } from '..';
import { pgOnly } from '@nocobase/test';
pgOnly()('Inherited Collection', () => {
let db: Database;
let app: Application;
let collectionRepository: Repository;
let fieldsRepository: Repository;
beforeEach(async () => {
app = await createApp({
database: {
schema: 'testSchema',
},
});
db = app.db;
collectionRepository = db.getCollection('collections').repository;
fieldsRepository = db.getCollection('fields').repository;
});
afterEach(async () => {
await app.destroy();
});
it('should create inherited collection in difference schema', async () => {
await collectionRepository.create({
values: {
name: 'b',
fields: [
{
name: 'name',
type: 'string',
},
],
},
context: {},
});
await collectionRepository.create({
values: {
name: 'a',
inherits: ['b'],
fields: [{ type: 'string', name: 'bField' }],
},
context: {},
});
});
});
pgOnly()('Inherited Collection', () => {
let db: Database;
let app: Application;

View File

@ -0,0 +1,54 @@
import Database, { Repository } from '@nocobase/database';
import Application from '@nocobase/server';
import { createApp } from '..';
import { pgOnly } from '@nocobase/test';
pgOnly()('Inherited Collection with schema options', () => {
let db: Database;
let app: Application;
let collectionRepository: Repository;
let fieldsRepository: Repository;
beforeEach(async () => {
app = await createApp({
database: {
schema: 'testSchema',
},
});
db = app.db;
collectionRepository = db.getCollection('collections').repository;
fieldsRepository = db.getCollection('fields').repository;
});
afterEach(async () => {
await app.destroy();
});
it('should create inherited collection in difference schema', async () => {
await collectionRepository.create({
values: {
name: 'b',
fields: [
{
name: 'name',
type: 'string',
},
],
},
context: {},
});
await collectionRepository.create({
values: {
name: 'a',
inherits: ['b'],
fields: [{ type: 'string', name: 'bField' }],
},
context: {},
});
});
});