mirror of
https://github.com/Floriansylvain/SnippetsManager.git
synced 2026-08-20 03:43:35 +02:00
Added PUT route for Snippet
This commit is contained in:
@@ -15,8 +15,6 @@ const testUserCredentials = {
|
||||
let category_id: number
|
||||
let snippet_id: number
|
||||
|
||||
// Mettre a jour les routes Category en stockant les IDs sur GET pour reutiliser sur DELETE
|
||||
|
||||
beforeAll(async () => {
|
||||
await prisma.user.create({
|
||||
data: {
|
||||
@@ -239,6 +237,24 @@ describe('GET /v1/snippet', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('PUT /v1/snippet/:id', () => {
|
||||
it('returns status code 200 and success message', async () => {
|
||||
const res = await request(app)
|
||||
.put(`/v1/snippet/${snippet_id}`)
|
||||
.set('Content-Type', 'application/json')
|
||||
.set('Cookie', jwtCookie as string)
|
||||
.send(JSON.stringify({
|
||||
code: '<p>en fait non à vuejs</p>',
|
||||
// language: 'html'
|
||||
}))
|
||||
|
||||
console.debug(res.body)
|
||||
|
||||
expect(res.status).toEqual(200)
|
||||
expect(res.body).toHaveProperty('message')
|
||||
})
|
||||
})
|
||||
|
||||
describe('DELETE /v1/snippet', () => {
|
||||
it('returns status code 200 and success message', async () => {
|
||||
const res = await request(app)
|
||||
|
||||
Reference in New Issue
Block a user