@friggframework/core 2.0.0--canary.461.4e275f3.0 → 2.0.0--canary.461.dc1758e.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,13 +5,13 @@ class CheckIntegrationsHealthUseCase {
5
5
  }
6
6
 
7
7
  execute() {
8
- const moduleTypes = Array.isArray(this.moduleFactory.moduleTypes)
8
+ const moduleTypes = (this.moduleFactory && Array.isArray(this.moduleFactory.moduleTypes))
9
9
  ? this.moduleFactory.moduleTypes
10
10
  : [];
11
11
 
12
- const integrationTypes = Array.isArray(
12
+ const integrationTypes = (this.integrationFactory && Array.isArray(
13
13
  this.integrationFactory.integrationTypes
14
- )
14
+ ))
15
15
  ? this.integrationFactory.integrationTypes
16
16
  : [];
17
17
 
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Tests for CheckIntegrationsHealthUseCase
3
+ *
4
+ * Tests integration and module factory health checking
5
+ */
6
+
7
+ const { CheckIntegrationsHealthUseCase } = require('./check-integrations-health-use-case');
8
+
9
+ describe('CheckIntegrationsHealthUseCase', () => {
10
+ describe('execute()', () => {
11
+ it('should return healthy status with module and integration counts', () => {
12
+ const mockModuleFactory = {
13
+ moduleTypes: ['HubSpot', 'Salesforce', 'Slack'],
14
+ };
15
+
16
+ const mockIntegrationFactory = {
17
+ integrationTypes: ['HubSpot-to-Salesforce', 'Slack-Notifications'],
18
+ };
19
+
20
+ const useCase = new CheckIntegrationsHealthUseCase({
21
+ moduleFactory: mockModuleFactory,
22
+ integrationFactory: mockIntegrationFactory,
23
+ });
24
+
25
+ const result = useCase.execute();
26
+
27
+ expect(result.status).toBe('healthy');
28
+ expect(result.modules.count).toBe(3);
29
+ expect(result.modules.available).toEqual(['HubSpot', 'Salesforce', 'Slack']);
30
+ expect(result.integrations.count).toBe(2);
31
+ expect(result.integrations.available).toEqual(['HubSpot-to-Salesforce', 'Slack-Notifications']);
32
+ });
33
+
34
+ it('should handle undefined moduleFactory gracefully', () => {
35
+ const mockIntegrationFactory = {
36
+ integrationTypes: ['Integration1'],
37
+ };
38
+
39
+ const useCase = new CheckIntegrationsHealthUseCase({
40
+ moduleFactory: undefined,
41
+ integrationFactory: mockIntegrationFactory,
42
+ });
43
+
44
+ const result = useCase.execute();
45
+
46
+ expect(result.status).toBe('healthy');
47
+ expect(result.modules.count).toBe(0);
48
+ expect(result.modules.available).toEqual([]);
49
+ expect(result.integrations.count).toBe(1);
50
+ });
51
+
52
+ it('should handle undefined integrationFactory gracefully', () => {
53
+ const mockModuleFactory = {
54
+ moduleTypes: ['Module1'],
55
+ };
56
+
57
+ const useCase = new CheckIntegrationsHealthUseCase({
58
+ moduleFactory: mockModuleFactory,
59
+ integrationFactory: undefined,
60
+ });
61
+
62
+ const result = useCase.execute();
63
+
64
+ expect(result.status).toBe('healthy');
65
+ expect(result.modules.count).toBe(1);
66
+ expect(result.integrations.count).toBe(0);
67
+ expect(result.integrations.available).toEqual([]);
68
+ });
69
+
70
+ it('should handle both factories being undefined', () => {
71
+ const useCase = new CheckIntegrationsHealthUseCase({
72
+ moduleFactory: undefined,
73
+ integrationFactory: undefined,
74
+ });
75
+
76
+ const result = useCase.execute();
77
+
78
+ expect(result.status).toBe('healthy');
79
+ expect(result.modules.count).toBe(0);
80
+ expect(result.modules.available).toEqual([]);
81
+ expect(result.integrations.count).toBe(0);
82
+ expect(result.integrations.available).toEqual([]);
83
+ });
84
+
85
+ it('should handle non-array moduleTypes', () => {
86
+ const mockModuleFactory = {
87
+ moduleTypes: 'not-an-array',
88
+ };
89
+
90
+ const mockIntegrationFactory = {
91
+ integrationTypes: [],
92
+ };
93
+
94
+ const useCase = new CheckIntegrationsHealthUseCase({
95
+ moduleFactory: mockModuleFactory,
96
+ integrationFactory: mockIntegrationFactory,
97
+ });
98
+
99
+ const result = useCase.execute();
100
+
101
+ expect(result.status).toBe('healthy');
102
+ expect(result.modules.count).toBe(0);
103
+ expect(result.modules.available).toEqual([]);
104
+ });
105
+
106
+ it('should handle factories with missing moduleTypes/integrationTypes properties', () => {
107
+ const mockModuleFactory = {}; // No moduleTypes property
108
+ const mockIntegrationFactory = {}; // No integrationTypes property
109
+
110
+ const useCase = new CheckIntegrationsHealthUseCase({
111
+ moduleFactory: mockModuleFactory,
112
+ integrationFactory: mockIntegrationFactory,
113
+ });
114
+
115
+ const result = useCase.execute();
116
+
117
+ expect(result.status).toBe('healthy');
118
+ expect(result.modules.count).toBe(0);
119
+ expect(result.modules.available).toEqual([]);
120
+ expect(result.integrations.count).toBe(0);
121
+ expect(result.integrations.available).toEqual([]);
122
+ });
123
+ });
124
+ });
125
+
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/core",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.461.4e275f3.0",
4
+ "version": "2.0.0--canary.461.dc1758e.0",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
7
7
  "@aws-sdk/client-kms": "^3.588.0",
@@ -37,9 +37,9 @@
37
37
  }
38
38
  },
39
39
  "devDependencies": {
40
- "@friggframework/eslint-config": "2.0.0--canary.461.4e275f3.0",
41
- "@friggframework/prettier-config": "2.0.0--canary.461.4e275f3.0",
42
- "@friggframework/test": "2.0.0--canary.461.4e275f3.0",
40
+ "@friggframework/eslint-config": "2.0.0--canary.461.dc1758e.0",
41
+ "@friggframework/prettier-config": "2.0.0--canary.461.dc1758e.0",
42
+ "@friggframework/test": "2.0.0--canary.461.dc1758e.0",
43
43
  "@prisma/client": "^6.17.0",
44
44
  "@types/lodash": "4.17.15",
45
45
  "@typescript-eslint/eslint-plugin": "^8.0.0",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "4e275f3550aa70a2d9a2eed110f51086a15035cd"
82
+ "gitHead": "dc1758e91e27ea006df8936d372f468f029ec646"
83
83
  }