mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(eventbridge): apply InputPath when delivering events to targets (#335)
This commit is contained in:
1 parent
f98abd6e0e
commit
68311a5b47
2 files changed
+35
No files matched your search
+25
@@ -50,6 +50,31 @@ class EventBridgeInvokerTest {
|
||||
assertEquals("42", invoker.extractJsonPath("$.detail.size", event));
|
||||
}
|
||||
|
||||
@Test
|
||||
void applyInputPath_extractsNestedField() {
|
||||
String event = "{\"source\":\"aws.s3\",\"detail\":{\"bucket\":\"my-bucket\",\"key\":\"file.txt\"}}";
|
||||
String result = invoker.applyInputPath("$.detail", event);
|
||||
assertEquals("{\"bucket\":\"my-bucket\",\"key\":\"file.txt\"}", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
void applyInputPath_dollarSignReturnsFullEvent() {
|
||||
String event = "{\"source\":\"aws.s3\"}";
|
||||
assertEquals(event, invoker.applyInputPath("$", event));
|
||||
}
|
||||
|
||||
@Test
|
||||
void applyInputPath_missingField_returnsFullEvent() {
|
||||
String event = "{\"source\":\"aws.s3\"}";
|
||||
assertEquals(event, invoker.applyInputPath("$.detail", event));
|
||||
}
|
||||
|
||||
@Test
|
||||
void applyInputPath_scalarField_returnsText() {
|
||||
String event = "{\"detail\":{\"name\":\"test\"}}";
|
||||
assertEquals("test", invoker.applyInputPath("$.detail.name", event));
|
||||
}
|
||||
|
||||
@Test
|
||||
void applyInputTransformer_substitutesVariables() {
|
||||
String eventJson = "{\"source\":\"aws.s3\",\"detail\":{\"bucket\":{\"name\":\"my-bucket\"},\"object\":{\"key\":\"photos/cat.jpg\"}}}";
|
||||
|
||||
Reference in new issue
Block a user