undeexcepturi
Version:
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 JavaScript.
30 lines (20 loc) • 549 B
text/typescript
import { Entity, MikroORM, PrimaryKey, Property } from '@mikro-orm/sqlite';
class A {
id!: number;
test!: string;
}
class B {
id!: number;
a!: A;
}
test('validates @Property() decorator targeting entity type', async () => {
await expect(MikroORM.init({
entities: [A, B],
dbName: ':memory:',
})).rejects.toThrow('B.a is defined as scalar @Property(), but its type is a discovered entity A. Maybe you want to use @ManyToOne() decorator instead?');
});