UNPKG

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
import { Entity, MikroORM, PrimaryKey, Property } from '@mikro-orm/sqlite'; class A { @PrimaryKey() id!: number; @Property() test!: string; } @Entity() class B { @PrimaryKey() id!: number; @Property() 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?'); });