Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete on prisma models throws an error #935

Open
mxrcochxvez opened this issue May 28, 2024 · 1 comment
Open

Delete on prisma models throws an error #935

mxrcochxvez opened this issue May 28, 2024 · 1 comment
Labels
question Further information is requested

Comments

@mxrcochxvez
Copy link

mxrcochxvez commented May 28, 2024

For privacy reasons I am going to make this code as ambiguous as possible. However the concept very closely follows what I am trying to achieve.

posts.repo.ts

export const postsRepo = { deletePosts };

function deletePosts(postId: string) {
    return prisma.posts.delete({ where: { id: postId } });
}

mock-prisma.ts (setupTests method)

jest.mock('@prisma/client', () => {
	return {
		...jest.requireActual('@prisma/client'),
		PrismaClient: jest.requireActual('prismock').PrismockClient,
	};
});

posts.spec.ts

test('it should delete a post', async () => {
    try {
        const result = await postsRepo.deletePosts('1');

        expect(results).toBeTruthy();
    } catch(error) {
        console.log(error);
    }
})

I am getting the following error

image
@morintd
Copy link
Owner

morintd commented Jun 4, 2024

Hello @mxrcochxvez , thanks a lot. Unfortunately, I don't have enough information to find where this issue is coming from. This might be related to your specific use case, would you be able to create a minimum reproductible example on a public repository? Maybe you have more information on the error too?

@morintd morintd added the question Further information is requested label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants