45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { TestContext } from './Context';
|
|
import { MysqlStore } from '../src/MySQL/store';
|
|
import { EntityDict, storageSchema } from './test-app-domain';
|
|
import { describe, it, before, after } from 'mocha';
|
|
import { tests } from './testcase';
|
|
|
|
describe('test mysqlstore', async function () {
|
|
this.timeout(60000);
|
|
let store: MysqlStore<EntityDict, TestContext>;
|
|
|
|
before(async () => {
|
|
store = new MysqlStore(storageSchema, {
|
|
host: 'localhost',
|
|
database: 'oakdb',
|
|
user: 'root',
|
|
password: 'root',
|
|
charset: 'utf8mb4_general_ci',
|
|
connectionLimit: 20,
|
|
});
|
|
store.connect();
|
|
await store.initialize({
|
|
ifExists: 'drop',
|
|
});
|
|
});
|
|
|
|
tests(() => store!)
|
|
|
|
it('[2.0.1]read schema', async () => {
|
|
const result = await store.readSchema();
|
|
|
|
console.log(result);
|
|
});
|
|
|
|
it('[2.0.2]diff schema', async () => {
|
|
const result = await store.makeUpgradePlan();
|
|
|
|
console.log(result);
|
|
});
|
|
|
|
|
|
after(() => {
|
|
store.disconnect();
|
|
});
|
|
});
|