oak-db/test/testPostgresStore.ts

35 lines
1012 B
TypeScript

import { PostgreSQLStore } from '../lib/PostgreSQL/store';
import assert from 'assert';
import { TestContext } from './Context';
import { v4 } from 'uuid';
import { EntityDict, storageSchema } from './test-app-domain';
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
import { WebConfig } from './test-app-domain/Application/Schema';
import { describe, it, before, after } from './utils/test';
import { tests } from './testcase';
describe('test postgresstore', async function () {
let store: PostgreSQLStore<EntityDict, TestContext>;
before(async () => {
store = new PostgreSQLStore(storageSchema, {
host: 'localhost',
database: 'oakdb',
user: 'postgres',
password: 'postgres',
max: 20,
port: 5432,
});
store.connect();
await store.initialize({
ifExists: 'drop',
});
});
tests(() => store!)
after(() => {
store.disconnect();
});
});