Skip to content

Commit d840457

Browse files
committed
test: update custom instance test for cross-bundle compatibility
Custom ObjectEnumValue instances are now accepted because we use a global symbol for detection instead of singleton equality checks. This is necessary for cross-bundle support — a singleton from a different bundle is indistinguishable from a custom instance.
1 parent a777e26 commit d840457

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

  • packages/client/tests/functional/json-null-types

packages/client/tests/functional/json-null-types/tests.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,14 @@ testMatrix.setupTestSuite(
7272
expect(Prisma.AnyNull).toBeInstanceOf(Prisma.NullTypes.AnyNull)
7373
})
7474

75-
test('custom instances are not allowed', async () => {
76-
await expect(
77-
prisma.requiredJsonField.create({
78-
data: {
79-
// @ts-expect-error
80-
json: new Prisma.NullTypes.JsonNull(),
81-
},
82-
}),
83-
).rejects.toMatchPrismaErrorInlineSnapshot(`"Invalid ObjectEnumValue"`)
75+
test('custom instances are accepted for cross-bundle compatibility', async () => {
76+
const record = await prisma.requiredJsonField.create({
77+
data: {
78+
// @ts-expect-error
79+
json: new Prisma.NullTypes.JsonNull(),
80+
},
81+
})
82+
expect(record.json).toBeNull()
8483
})
8584
})
8685
},

0 commit comments

Comments
 (0)