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 (22 loc) 874 B
import { MikroORM } from '@mikro-orm/mongodb'; import { Author, Book } from '../entities'; import { closeReplSets, initORMMongo } from '../bootstrap'; describe('GH4065', () => { let orm: MikroORM; beforeAll(async () => orm = await initORMMongo()); beforeEach(async () => orm.schema.clearDatabase()); afterAll(async () => { await orm.close(); await closeReplSets(); }); test('should load entities with $fulltext and filter set', async () => { const god = new Author('God', 'hello@heaven.god'); const bible = new Book('Bible', god); await orm.em.persistAndFlush(bible); orm.em.clear(); const booksRepository = orm.em.getRepository(Book); orm.em.addFilter('BreakFulltext', { title: { $re: '.*' } }, Book, true); const books = await booksRepository.find({ $fulltext: 'Bible' }); expect(books.length).toBe(1); }); });