-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add integration tests for TrackService
- Loading branch information
1 parent
07a41a9
commit e68f39e
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/integrationTest/java/com/yuriytkach/tracker/fundraiser/service/TrackServiceIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.yuriytkach.tracker.fundraiser.service; | ||
|
||
import com.yuriytkach.tracker.fundraiser.AwsLambdaIntegrationTestCommon; | ||
import com.yuriytkach.tracker.fundraiser.model.Donation; | ||
import com.yuriytkach.tracker.fundraiser.model.Fund; | ||
import io.quarkus.amazon.lambda.http.model.AwsProxyRequest; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.restassured.RestAssured; | ||
import jakarta.ws.rs.core.MediaType; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
@QuarkusTest | ||
public class TrackServiceIT extends AwsLambdaIntegrationTestCommon { | ||
|
||
@Test | ||
public void testProcessTrackCommand() { | ||
AwsProxyRequest request = createAwsProxyRequest( | ||
"/slack/cmd", | ||
"POST", | ||
Map.of( | ||
"Content-Type", MediaType.APPLICATION_FORM_URLENCODED, | ||
"Accept", MediaType.APPLICATION_JSON | ||
) | ||
); | ||
|
||
String response = RestAssured.given() | ||
.contentType(MediaType.APPLICATION_JSON) | ||
.body(request) | ||
.when() | ||
.post(LAMBDA_URL_PATH) | ||
.then() | ||
.statusCode(200) | ||
.extract() | ||
.asString(); | ||
|
||
Assertions.assertNotNull(response); | ||
Assertions.assertTrue(response.contains("Tracked")); | ||
} | ||
} |