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:
parent
e49e272f7a
commit
2677f7c3d3
2 changed files with 25 additions and 0 deletions
|
@ -40,3 +40,13 @@ beforeEach(() => {
|
|||
})
|
||||
cy.visit('/')
|
||||
})
|
||||
|
||||
after(() => {
|
||||
cy.apiRequest({
|
||||
method: 'POST',
|
||||
url: 'e2e/clean',
|
||||
body: {},
|
||||
}).then((response) => {
|
||||
expect(response.status).to.equal(200)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue