quaerateum
Version:
Simple typescript ORM for node.js based on data-mapper, unit-of-work and identity-map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JS.
34 lines (26 loc) • 812 B
text/typescript
import { SchemaHelper } from '../lib/schema';
class SchemaHelperTest extends SchemaHelper {
supportsSequences(): boolean {
return true;
}
}
/**
* @class SchemaHelperTest
*/
describe('SchemaHelper', () => {
test('default schema helpers', async () => {
const helper = new SchemaHelperTest();
expect(helper.getSchemaBeginning()).toBe('');
expect(helper.getSchemaEnd()).toBe('');
expect(helper.supportsSequences()).toBe(true);
expect(helper.getTypeDefinition({ type: 'test' } as any)).toBe('test');
const meta = {
collection: 'test',
primaryKey: 'pk',
properties: {
pk: { name: 'pk', type: 'number' },
},
};
expect(helper.dropTable(meta as any)).toBe('DROP TABLE IF EXISTS "test";\nDROP SEQUENCE IF EXISTS "test_seq";\n');
});
});