chore: test

This commit is contained in:
Chareice 2023-02-15 00:18:41 +08:00
parent 91f19c2419
commit 1575364736
5 changed files with 8 additions and 6 deletions

View File

@ -542,4 +542,8 @@ export class Collection<
return tableName; return tableName;
} }
public quotedTableName() {
return this.db.utils.quoteTable(this.addSchemaTableName());
}
} }

View File

@ -19,6 +19,7 @@ describe('dump', () => {
app = mockServer(); app = mockServer();
db = app.db; db = app.db;
await app.cleanDb();
app.db.collection({ app.db.collection({
name: 'users', name: 'users',
@ -52,7 +53,6 @@ describe('dump', () => {
fields: [], fields: [],
}); });
await app.cleanDb();
await db.sync(); await db.sync();
}); });

View File

@ -177,7 +177,7 @@ ORDER BY table_schema, table_name`,
const dataStream = fs.createWriteStream(dataFilePath); const dataStream = fs.createWriteStream(dataFilePath);
const rows = await app.db.sequelize.query( const rows = await app.db.sequelize.query(
sqlAdapter(app.db, `SELECT * FROM ${collection.isParent() ? 'ONLY' : ''} "${collection.model.tableName}"`), sqlAdapter(app.db, `SELECT * FROM ${collection.isParent() ? 'ONLY' : ''} ${collection.quotedTableName()}`),
{ {
type: 'SELECT', type: 'SELECT',
}, },

View File

@ -19,9 +19,7 @@ describe('ui schema model', () => {
db = app.db; db = app.db;
const queryInterface = db.sequelize.getQueryInterface(); await db.clean({ drop: true });
await queryInterface.dropAllTables();
app.plugin(PluginUiSchema, { name: 'ui-schema-storage' }); app.plugin(PluginUiSchema, { name: 'ui-schema-storage' });
await app.load(); await app.load();

View File

@ -23,7 +23,7 @@ describe('ui_schema repository with cache', () => {
db = app.db; db = app.db;
cache = app.cache; cache = app.cache;
await db.sequelize.getQueryInterface().dropAllTables(); await db.clean({ drop: true });
app.plugin(PluginUiSchema, { name: 'ui-schema-storage' }); app.plugin(PluginUiSchema, { name: 'ui-schema-storage' });