|
3 | 3 | import com.objectcomputing.checkins.configuration.CheckInsConfiguration; |
4 | 4 | import com.objectcomputing.checkins.notifications.email.MailJetFactory; |
5 | 5 | import com.objectcomputing.checkins.services.MailJetFactoryReplacement; |
6 | | -import com.objectcomputing.checkins.services.SlackPosterReplacement; |
| 6 | +import com.objectcomputing.checkins.services.SlackSenderReplacement; |
7 | 7 | import com.objectcomputing.checkins.services.TestContainersSuite; |
8 | 8 | import com.objectcomputing.checkins.services.fixture.KudosFixture; |
9 | 9 | import com.objectcomputing.checkins.services.fixture.TeamFixture; |
|
60 | 60 | // when attempting to post public Kudos to Slack. |
61 | 61 | @DisabledInNativeImage |
62 | 62 | @Property(name = "replace.mailjet.factory", value = StringUtils.TRUE) |
63 | | -@Property(name = "replace.slackposter", value = StringUtils.TRUE) |
| 63 | +@Property(name = "replace.slacksender", value = StringUtils.TRUE) |
64 | 64 | class KudosControllerTest extends TestContainersSuite implements KudosFixture, TeamFixture, RoleFixture { |
65 | 65 | @Inject |
66 | 66 | @Named(MailJetFactory.HTML_FORMAT) |
67 | 67 | private MailJetFactoryReplacement.MockEmailSender emailSender; |
68 | 68 |
|
69 | 69 | @Inject |
70 | | - private SlackPosterReplacement slackPoster; |
| 70 | + private SlackSenderReplacement slackSender; |
71 | 71 |
|
72 | 72 | @Inject |
73 | 73 | @Client("/services/kudos") |
@@ -110,7 +110,7 @@ void setUp() { |
110 | 110 |
|
111 | 111 | message = "Kudos!"; |
112 | 112 | emailSender.reset(); |
113 | | - slackPoster.reset(); |
| 113 | + slackSender.reset(); |
114 | 114 | } |
115 | 115 |
|
116 | 116 | @ParameterizedTest |
@@ -252,15 +252,16 @@ void testApproveKudos() throws JsonProcessingException { |
252 | 252 | ); |
253 | 253 |
|
254 | 254 | // Check the posted slack block |
255 | | - assertEquals(1, slackPoster.posted.size()); |
| 255 | + assertEquals(1, slackSender.sent.size()); |
256 | 256 | ObjectMapper mapper = new ObjectMapper(); |
257 | | - JsonNode posted = mapper.readTree(slackPoster.posted.get(0)); |
| 257 | + String channelId = checkInsConfiguration.getApplication() |
| 258 | + .getSlack().getKudosChannel(); |
| 259 | + List<String> sent = slackSender.sent.get(channelId); |
| 260 | + JsonNode posted = mapper.readTree(sent.get(0)); |
258 | 261 |
|
259 | | - assertEquals(JsonNodeType.OBJECT, posted.getNodeType()); |
260 | | - JsonNode blocks = posted.get("blocks"); |
261 | | - assertEquals(JsonNodeType.ARRAY, blocks.getNodeType()); |
| 262 | + assertEquals(JsonNodeType.ARRAY, posted.getNodeType()); |
262 | 263 |
|
263 | | - var iter = blocks.elements(); |
| 264 | + var iter = posted.elements(); |
264 | 265 | assertTrue(iter.hasNext()); |
265 | 266 | JsonNode block = iter.next(); |
266 | 267 |
|
|
0 commit comments