MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / logAuthor

Function logAuthor

tests/features/lazy-ref.test.ts:145–147  ·  view source on GitHub ↗
(b: Book)

Source from the content-addressed store, hash-verified

143 const book = await orm.em.findOneOrFail(Book, bookId, { populate: ['author'] });
144 // even though `book.author` is typed as `LazyRef<Author>` in a bare `Book`, unref escapes the brand
145 function logAuthor(b: Book) {
146 return unref(b.author).name;
147 }
148 expect(logAuthor(book)).toBe('Stephen King');
149 });
150

Callers 1

lazy-ref.test.tsFile · 0.85

Calls 1

unrefFunction · 0.90

Tested by

no test coverage detected