prismock
prismock copied to clipboard
fix: bug in scalar list push support that would push the push function of arrays onto each array
The current code trips on things like:
this.prisma.someModel.update({
where: { id },
data: {
someList: ["a", "b", "c"],
},
})
Since the array ["a", "b", "c"]
itself has a push function, it would push the push function itself into the array and insert it into the DB.
Sorry for causing this bug. Can you please add a test?
I noticed we have a non-scalar list in our codebase that gets pushed. I'm not sure this is supported prisma behaviour (I can't find anything on non-scalar lists at all), but it seems to work, so I removed the === 'scalar'
test to make tests work.
Hello @CrystallineCat , thanks again! I'll track that inside https://github.com/morintd/prismock/pull/923. If you have another PR, feel free to raise it from a different branch than master. It will allow me to use it directly with my CI (I'm also open if there is a different process)!
Thanks anyway!