chore: improve mikro orm serializer circular ref and link serialization (#9411)
This commit is contained in:
committed by
GitHub
parent
2d1cf12dac
commit
225d00cd09
@@ -82,7 +82,7 @@ describe("EntityBuilder | enum", () => {
|
||||
id: user1.id,
|
||||
})
|
||||
|
||||
expect(mikroOrmSerializer<InstanceType<typeof User>>(user)).toEqual({
|
||||
expect(await mikroOrmSerializer<InstanceType<typeof User>>(user)).toEqual({
|
||||
id: user1.id,
|
||||
username: "User 1",
|
||||
role: "admin",
|
||||
|
||||
@@ -92,7 +92,7 @@ describe("hasOne - belongTo", () => {
|
||||
}
|
||||
)
|
||||
|
||||
expect(mikroOrmSerializer<InstanceType<typeof User>>(user)).toEqual({
|
||||
expect(await mikroOrmSerializer<InstanceType<typeof User>>(user)).toEqual({
|
||||
id: user1.id,
|
||||
username: "User 1",
|
||||
created_at: expect.any(Date),
|
||||
@@ -137,7 +137,7 @@ describe("hasOne - belongTo", () => {
|
||||
}
|
||||
)
|
||||
|
||||
expect(mikroOrmSerializer<InstanceType<typeof User>>(user)).toEqual({
|
||||
expect(await mikroOrmSerializer<InstanceType<typeof User>>(user)).toEqual({
|
||||
id: user1.id,
|
||||
username: "User 1",
|
||||
created_at: expect.any(Date),
|
||||
|
||||
@@ -129,7 +129,9 @@ describe("manyToMany - manyToMany", () => {
|
||||
}
|
||||
)
|
||||
|
||||
const serializedSquad = mikroOrmSerializer<InstanceType<typeof Team>>(team)
|
||||
const serializedSquad = await mikroOrmSerializer<InstanceType<typeof Team>>(
|
||||
team
|
||||
)
|
||||
|
||||
expect(serializedSquad.users).toHaveLength(2)
|
||||
expect(serializedSquad).toEqual({
|
||||
@@ -166,7 +168,9 @@ describe("manyToMany - manyToMany", () => {
|
||||
}
|
||||
)
|
||||
|
||||
const serializedUser = mikroOrmSerializer<InstanceType<typeof User>>(user)
|
||||
const serializedUser = await mikroOrmSerializer<InstanceType<typeof User>>(
|
||||
user
|
||||
)
|
||||
|
||||
expect(serializedUser.squads).toHaveLength(1)
|
||||
expect(serializedUser).toEqual({
|
||||
|
||||
@@ -104,7 +104,7 @@ describe("manyToOne - belongTo", () => {
|
||||
}
|
||||
)
|
||||
|
||||
expect(mikroOrmSerializer<InstanceType<typeof Team>>(team)).toEqual({
|
||||
expect(await mikroOrmSerializer<InstanceType<typeof Team>>(team)).toEqual({
|
||||
id: team1.id,
|
||||
name: "Team 1",
|
||||
created_at: expect.any(Date),
|
||||
@@ -130,7 +130,7 @@ describe("manyToOne - belongTo", () => {
|
||||
}
|
||||
)
|
||||
|
||||
expect(mikroOrmSerializer<InstanceType<typeof User>>(user)).toEqual({
|
||||
expect(await mikroOrmSerializer<InstanceType<typeof User>>(user)).toEqual({
|
||||
id: user1.id,
|
||||
username: "User 1",
|
||||
created_at: expect.any(Date),
|
||||
|
||||
Reference in New Issue
Block a user