npm package diff
Package: @forge/events
Versions: 1.0.3-next.0-experimental-f44d099 - 1.0.3-next.0-experimental-786d4ac
File: package/src/__test__/appEvents.test.ts
Index: package/src/__test__/appEvents.test.ts
===================================================================
--- package/src/__test__/appEvents.test.ts
+++ package/src/__test__/appEvents.test.ts
@@ -20,9 +20,14 @@
describe('publishEvent', () => {
it('should call post with the correct parameters', async () => {
// Arrange
const event: AppEvent = { key: 'test-event' };
- const mockResponse = { ok: true, json: jest.fn() };
+ const mockResponse = {
+ ok: true,
+ json: jest.fn().mockResolvedValue({
+ failedEvents: []
+ })
+ };
// Mock the post function to return a successful response
(post as jest.Mock).mockResolvedValue(mockResponse);
@@ -41,24 +46,29 @@
]
},
__requestAtlassianAsApp
);
- expect(result).toEqual({ type: 'success' });
+ expect(result).toEqual({ type: 'success', failedEvents: [] });
});
it('should return a success result for successful requests', async () => {
// Arrange
const event: AppEvent = { key: 'test-event' };
- const mockResponse = { ok: true, json: jest.fn() };
+ const mockResponse = {
+ ok: true,
+ json: jest.fn().mockResolvedValue({
+ failedEvents: []
+ })
+ };
// Mock the post function to return a successful response
(post as jest.Mock).mockResolvedValue(mockResponse);
// Act
const result = await appEvents.publish(event);
// Assert
- expect(result).toEqual({ type: 'success' });
+ expect(result).toEqual({ type: 'success', failedEvents: [] });
});
it('should return an error result for failed requests', async () => {
// Arrange