Skip to content

Commit

Permalink
docs: started documentation while #144 is not done
Browse files Browse the repository at this point in the history
  • Loading branch information
AvilaAndre committed Nov 6, 2024
1 parent 2735fdc commit 12d6616
Showing 1 changed file with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,10 @@ internal class EventControllerTest @Autowired constructor(
repository.save(testEvent)
}

private val parameters = listOf(
parameterWithName("idEvent").description("The id of the event being targeted")
)

@Test
fun `should add an image`() {
val expectedImagePath = "${uploadConfigProperties.staticServe}/events/gallery/${testEvent.title}-$uuid.jpeg"
Expand All @@ -859,6 +863,14 @@ internal class EventControllerTest @Autowired constructor(
jsonPath("$.slug").value(testEvent.slug),
jsonPath("$.image").value(testEvent.image)
)
/*
.andDocument(
documentation,
"Adds an image to the gallery of the selected event",
"This endpoint adds an image to the gallery of an event, returning the event's updated data.",
urlParameters = parameters
)
*/
}

@Test
Expand All @@ -874,7 +886,7 @@ internal class EventControllerTest @Autowired constructor(
content().contentType(MediaType.APPLICATION_JSON),
jsonPath("$.errors.length()").value(1),
jsonPath("$.errors[0].message").value("activity not found with id $nonexistentID")
)
).andDocumentErrorResponse(documentation)
}

@Test
Expand All @@ -888,7 +900,7 @@ internal class EventControllerTest @Autowired constructor(
content().contentType(MediaType.APPLICATION_JSON),
jsonPath("$.errors.length()").value(1),
jsonPath("$.errors[0].message").value("invalid image type (png, jpg, jpeg or webp)")
)
).andDocumentErrorResponse(documentation)
}
}

Expand Down Expand Up @@ -920,6 +932,10 @@ internal class EventControllerTest @Autowired constructor(
repository.save(testEvent)
}

private val parameters = listOf(
parameterWithName("idEvent").description("The id of the event being targeted")
)

@Test
fun `should remove an image`() {
mockMvc.multipartBuilder("/events/${testEvent.id}/gallery")
Expand All @@ -941,6 +957,14 @@ internal class EventControllerTest @Autowired constructor(
jsonPath("$.slug").value(testEvent.slug),
jsonPath("$.image").value(testEvent.image)
)
/*
.andDocument(
documentation,
"Removes an image from the gallery of a selected event",
"This endpoint removes an image to the gallery of an event, returning the event's updated data.",
urlParameters = parameters
)
*/
}

@Test
Expand All @@ -956,7 +980,7 @@ internal class EventControllerTest @Autowired constructor(
content().contentType(MediaType.APPLICATION_JSON),
jsonPath("$.errors.length()").value(1),
jsonPath("$.errors[0].message").value("activity not found with id $nonexistentID")
)
).andDocumentErrorResponse(documentation)
}

@Test
Expand All @@ -972,7 +996,7 @@ internal class EventControllerTest @Autowired constructor(
content().contentType(MediaType.APPLICATION_JSON),
jsonPath("$.errors.length()").value(1),
jsonPath("$.errors[0].message").value("file not found with name $wrongImageUrl")
)
).andDocumentErrorResponse(documentation)
}
}

Expand Down

0 comments on commit 12d6616

Please sign in to comment.