Skip to content

Commit

Permalink
feat: Add integration tests for TrackService
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Dec 16, 2023
1 parent 07a41a9 commit e68f39e
Showing 1 changed file with 40 additions and 0 deletions.
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"));
}
}

0 comments on commit e68f39e

Please sign in to comment.