Skip to content

Commit cc40c78

Browse files
committed
bumped zod version in parser to 4.0.14 and fixed failing tests
1 parent a73b359 commit cc40c78

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/parser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,6 @@
216216
}
217217
},
218218
"devDependencies": {
219-
"zod": "^4.0.5"
219+
"zod": "^4.0.14"
220220
}
221221
}

packages/parser/tests/unit/envelopes/cloudwatch.test.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ describe('Envelope: CloudWatch', () => {
144144
});
145145
});
146146

147-
it('returns an error if the event is not a valid CloudWatch Logs event', () => {
147+
it('returns an error if the event is not a valid CloudWatch Logs event (invalid base64 passed in the data property)', () => {
148148
// Prepare
149149
const event = {
150150
awslogs: {
@@ -171,6 +171,34 @@ describe('Envelope: CloudWatch', () => {
171171
path: ['awslogs', 'data'],
172172
message: 'Invalid base64-encoded string',
173173
},
174+
],
175+
}),
176+
}),
177+
originalEvent: event,
178+
});
179+
});
180+
181+
it('returns an error if the event is not a valid CloudWatch Logs event (valid base64 passed but invalid JSON in the payload)', () => {
182+
// Prepare
183+
const event = {
184+
awslogs: {
185+
data: 'eyJ0ZXN0IjoidGVzdCJ9',
186+
},
187+
};
188+
189+
// Act
190+
const result = CloudWatchEnvelope.safeParse(event, z.object({}));
191+
192+
// Assess
193+
expect(result).toEqual({
194+
success: false,
195+
error: expect.objectContaining({
196+
name: 'ParseError',
197+
message: expect.stringContaining(
198+
'Failed to parse CloudWatch Log envelope'
199+
),
200+
cause: expect.objectContaining({
201+
issues: [
174202
{
175203
code: 'custom',
176204
message: 'Failed to decompress CloudWatch log data',

0 commit comments

Comments
 (0)