1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-09 07:25:19 +02:00

clean up after tests

This commit is contained in:
Tyler Myracle 2024-01-21 21:31:59 -06:00
parent e49e272f7a
commit 2677f7c3d3
2 changed files with 25 additions and 0 deletions

View file

@ -40,3 +40,13 @@ beforeEach(() => {
})
cy.visit('/')
})
after(() => {
cy.apiRequest({
method: 'POST',
url: 'e2e/clean',
body: {},
}).then((response) => {
expect(response.status).to.equal(200)
})
})

View file

@ -78,4 +78,19 @@ router.post(
})
)
router.post(
'/clean',
endpoint.create({
resolve: async ({ ctx }) => {
const user = ctx.user!
await ctx.prisma.$transaction([
ctx.prisma.$executeRaw`DELETE FROM "user" WHERE auth_id=${user.authId};`,
ctx.prisma.$executeRaw`DELETE FROM "auth_user" WHERE id=${user.authId};`,
])
return { success: true }
},
})
)
export default router