@friggframework/devtools 2.0.0--canary.520.6641121.0 → 2.0.0--canary.522.cbd3d5a.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.
- package/frigg-cli/README.md +1 -1
- package/frigg-cli/__tests__/application/use-cases/AddApiModuleToIntegrationUseCase.test.js +326 -0
- package/frigg-cli/__tests__/application/use-cases/CreateApiModuleUseCase.test.js +337 -0
- package/frigg-cli/__tests__/domain/entities/ApiModule.test.js +373 -0
- package/frigg-cli/__tests__/domain/entities/AppDefinition.test.js +313 -0
- package/frigg-cli/__tests__/domain/services/IntegrationValidator.test.js +269 -0
- package/frigg-cli/__tests__/domain/value-objects/IntegrationName.test.js +82 -0
- package/frigg-cli/__tests__/infrastructure/adapters/IntegrationJsUpdater.test.js +408 -0
- package/frigg-cli/__tests__/infrastructure/repositories/FileSystemApiModuleRepository.test.js +583 -0
- package/frigg-cli/__tests__/infrastructure/repositories/FileSystemAppDefinitionRepository.test.js +314 -0
- package/frigg-cli/__tests__/infrastructure/repositories/FileSystemIntegrationRepository.test.js +430 -0
- package/frigg-cli/__tests__/unit/commands/doctor.test.js +0 -2
- package/frigg-cli/__tests__/unit/commands/init.test.js +406 -0
- package/frigg-cli/__tests__/unit/commands/install.test.js +21 -17
- package/frigg-cli/__tests__/unit/commands/repair.test.js +275 -0
- package/frigg-cli/__tests__/unit/start-command/application/RunPreflightChecksUseCase.test.js +411 -0
- package/frigg-cli/__tests__/unit/start-command/infrastructure/DatabaseAdapter.test.js +405 -0
- package/frigg-cli/__tests__/unit/start-command/infrastructure/DockerAdapter.test.js +496 -0
- package/frigg-cli/__tests__/unit/start-command/presentation/InteractivePromptAdapter.test.js +474 -0
- package/frigg-cli/__tests__/unit/utils/output.test.js +196 -0
- package/frigg-cli/application/use-cases/AddApiModuleToIntegrationUseCase.js +93 -0
- package/frigg-cli/application/use-cases/CreateApiModuleUseCase.js +93 -0
- package/frigg-cli/application/use-cases/CreateIntegrationUseCase.js +103 -0
- package/frigg-cli/container.js +172 -0
- package/frigg-cli/docs/OUTPUT_MIGRATION_GUIDE.md +286 -0
- package/frigg-cli/doctor-command/index.js +17 -16
- package/frigg-cli/domain/entities/ApiModule.js +272 -0
- package/frigg-cli/domain/entities/AppDefinition.js +227 -0
- package/frigg-cli/domain/entities/Integration.js +198 -0
- package/frigg-cli/domain/exceptions/DomainException.js +24 -0
- package/frigg-cli/domain/ports/IApiModuleRepository.js +53 -0
- package/frigg-cli/domain/ports/IAppDefinitionRepository.js +43 -0
- package/frigg-cli/domain/ports/IIntegrationRepository.js +61 -0
- package/frigg-cli/domain/services/IntegrationValidator.js +185 -0
- package/frigg-cli/domain/value-objects/IntegrationId.js +42 -0
- package/frigg-cli/domain/value-objects/IntegrationName.js +60 -0
- package/frigg-cli/domain/value-objects/SemanticVersion.js +70 -0
- package/frigg-cli/index.js +21 -6
- package/frigg-cli/index.test.js +7 -1
- package/frigg-cli/infrastructure/UnitOfWork.js +46 -0
- package/frigg-cli/infrastructure/adapters/BackendJsUpdater.js +197 -0
- package/frigg-cli/infrastructure/adapters/FileSystemAdapter.js +224 -0
- package/frigg-cli/infrastructure/adapters/IntegrationJsUpdater.js +249 -0
- package/frigg-cli/infrastructure/adapters/SchemaValidator.js +92 -0
- package/frigg-cli/infrastructure/repositories/FileSystemApiModuleRepository.js +373 -0
- package/frigg-cli/infrastructure/repositories/FileSystemAppDefinitionRepository.js +116 -0
- package/frigg-cli/infrastructure/repositories/FileSystemIntegrationRepository.js +277 -0
- package/frigg-cli/init-command/backend-first-handler.js +124 -42
- package/frigg-cli/init-command/index.js +2 -1
- package/frigg-cli/init-command/template-handler.js +13 -3
- package/frigg-cli/install-command/backend-js.js +3 -3
- package/frigg-cli/install-command/environment-variables.js +16 -19
- package/frigg-cli/install-command/environment-variables.test.js +12 -13
- package/frigg-cli/install-command/index.js +14 -9
- package/frigg-cli/install-command/integration-file.js +3 -3
- package/frigg-cli/install-command/validate-package.js +5 -9
- package/frigg-cli/jest.config.js +4 -1
- package/frigg-cli/package-lock.json +16226 -0
- package/frigg-cli/repair-command/index.js +101 -128
- package/frigg-cli/start-command/application/RunPreflightChecksUseCase.js +376 -0
- package/frigg-cli/start-command/index.js +246 -2
- package/frigg-cli/start-command/infrastructure/DatabaseAdapter.js +591 -0
- package/frigg-cli/start-command/infrastructure/DockerAdapter.js +306 -0
- package/frigg-cli/start-command/presentation/InteractivePromptAdapter.js +329 -0
- package/frigg-cli/templates/backend/.env.example +62 -0
- package/frigg-cli/templates/backend/.eslintrc.json +12 -0
- package/frigg-cli/templates/backend/.prettierrc +6 -0
- package/frigg-cli/templates/backend/docker-compose.yml +22 -0
- package/frigg-cli/templates/backend/index.js +96 -0
- package/frigg-cli/templates/backend/infrastructure.js +12 -0
- package/frigg-cli/templates/backend/jest.config.js +17 -0
- package/frigg-cli/templates/backend/package.json +50 -0
- package/frigg-cli/templates/backend/src/api-modules/.gitkeep +10 -0
- package/frigg-cli/templates/backend/src/base/.gitkeep +7 -0
- package/frigg-cli/templates/backend/src/integrations/.gitkeep +10 -0
- package/frigg-cli/templates/backend/src/integrations/ExampleIntegration.js +65 -0
- package/frigg-cli/templates/backend/src/utils/.gitkeep +7 -0
- package/frigg-cli/templates/backend/test/setup.js +30 -0
- package/frigg-cli/templates/backend/ui-extensions/.gitkeep +0 -0
- package/frigg-cli/templates/backend/ui-extensions/README.md +77 -0
- package/frigg-cli/ui-command/index.js +58 -36
- package/frigg-cli/utils/__tests__/repo-detection.test.js +436 -0
- package/frigg-cli/utils/output.js +382 -0
- package/frigg-cli/utils/repo-detection.js +85 -37
- package/frigg-cli/validate-command/__tests__/adapters/validate-command.test.js +205 -0
- package/frigg-cli/validate-command/__tests__/application/validate-app-use-case.test.js +104 -0
- package/frigg-cli/validate-command/__tests__/domain/fix-suggestion.test.js +153 -0
- package/frigg-cli/validate-command/__tests__/domain/validation-error.test.js +162 -0
- package/frigg-cli/validate-command/__tests__/domain/validation-result.test.js +152 -0
- package/frigg-cli/validate-command/__tests__/infrastructure/api-module-validator.test.js +332 -0
- package/frigg-cli/validate-command/__tests__/infrastructure/app-definition-validator.test.js +191 -0
- package/frigg-cli/validate-command/__tests__/infrastructure/integration-class-validator.test.js +146 -0
- package/frigg-cli/validate-command/__tests__/infrastructure/template-validation.test.js +155 -0
- package/frigg-cli/validate-command/adapters/cli/validate-command.js +199 -0
- package/frigg-cli/validate-command/application/use-cases/validate-app-use-case.js +35 -0
- package/frigg-cli/validate-command/domain/entities/validation-result.js +74 -0
- package/frigg-cli/validate-command/domain/value-objects/fix-suggestion.js +74 -0
- package/frigg-cli/validate-command/domain/value-objects/validation-error.js +68 -0
- package/frigg-cli/validate-command/infrastructure/validators/api-module-validator.js +181 -0
- package/frigg-cli/validate-command/infrastructure/validators/app-definition-validator.js +128 -0
- package/frigg-cli/validate-command/infrastructure/validators/integration-class-validator.js +113 -0
- package/infrastructure/docs/iam-policy-templates.md +1 -1
- package/infrastructure/domains/admin-scripts/admin-script-builder.js +200 -0
- package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +499 -0
- package/infrastructure/domains/admin-scripts/index.js +5 -0
- package/infrastructure/domains/networking/vpc-builder.test.js +2 -4
- package/infrastructure/domains/networking/vpc-resolver.test.js +1 -1
- package/infrastructure/domains/shared/cloudformation-discovery.test.js +4 -7
- package/infrastructure/domains/shared/resource-discovery.js +5 -5
- package/infrastructure/domains/shared/types/app-definition.js +21 -0
- package/infrastructure/domains/shared/types/discovery-result.test.js +1 -1
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +10 -1
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +2 -2
- package/infrastructure/infrastructure-composer.js +2 -0
- package/infrastructure/infrastructure-composer.test.js +2 -2
- package/management-ui/README.md +245 -109
- package/package.json +8 -7
- package/frigg-cli/install-command/logger.js +0 -12
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for frigg repair command
|
|
3
|
+
* Tests repair workflow orchestration and output usage
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Mock all external dependencies
|
|
7
|
+
jest.mock('../../../utils/output');
|
|
8
|
+
jest.mock('../../../repair-command/index.js', () => {
|
|
9
|
+
const actualModule = jest.requireActual('../../../repair-command/index.js');
|
|
10
|
+
return actualModule;
|
|
11
|
+
}, { virtual: false });
|
|
12
|
+
|
|
13
|
+
const output = require('../../../utils/output');
|
|
14
|
+
|
|
15
|
+
describe('Repair Command - Output Integration', () => {
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
jest.clearAllMocks();
|
|
18
|
+
|
|
19
|
+
// Setup output mocks
|
|
20
|
+
output.success = jest.fn();
|
|
21
|
+
output.error = jest.fn();
|
|
22
|
+
output.info = jest.fn();
|
|
23
|
+
output.warn = jest.fn();
|
|
24
|
+
output.log = jest.fn();
|
|
25
|
+
output.confirm = jest.fn();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('Output method usage', () => {
|
|
29
|
+
test('should use output.success for successful operations', () => {
|
|
30
|
+
// Test that success messages use output.success
|
|
31
|
+
output.success(' No orphaned resources to import');
|
|
32
|
+
|
|
33
|
+
expect(output.success).toHaveBeenCalledWith(
|
|
34
|
+
expect.stringContaining('No orphaned resources')
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('should use output.error for error messages', () => {
|
|
39
|
+
// Test that errors use output.error
|
|
40
|
+
const error = new Error('Stack not found');
|
|
41
|
+
output.error('An error occurred:', error);
|
|
42
|
+
|
|
43
|
+
expect(output.error).toHaveBeenCalledWith('An error occurred:', error);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('should use output.info for informational messages', () => {
|
|
47
|
+
// Test that info messages use output.info with emoji
|
|
48
|
+
output.info('🔍 Analyzing stack health...');
|
|
49
|
+
|
|
50
|
+
expect(output.info).toHaveBeenCalledWith(
|
|
51
|
+
expect.stringContaining('Analyzing stack')
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('should use output.warn for warnings', () => {
|
|
56
|
+
// Test that warnings use output.warn
|
|
57
|
+
output.warn('️ Build template not found');
|
|
58
|
+
|
|
59
|
+
expect(output.warn).toHaveBeenCalledWith(
|
|
60
|
+
expect.stringContaining('Build template not found')
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('should use output.log for general messages', () => {
|
|
65
|
+
// Test that general messages use output.log
|
|
66
|
+
output.log(' • serverless package');
|
|
67
|
+
|
|
68
|
+
expect(output.log).toHaveBeenCalledWith(
|
|
69
|
+
expect.stringContaining('serverless package')
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('should use output.confirm for user confirmations', async () => {
|
|
74
|
+
// Test that confirmations use output.confirm
|
|
75
|
+
output.confirm.mockResolvedValue(true);
|
|
76
|
+
|
|
77
|
+
const result = await output.confirm('Import 5 orphaned resource(s)?');
|
|
78
|
+
|
|
79
|
+
expect(output.confirm).toHaveBeenCalledWith(
|
|
80
|
+
expect.stringContaining('Import')
|
|
81
|
+
);
|
|
82
|
+
expect(result).toBe(true);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe('Error handling scenarios', () => {
|
|
87
|
+
test('should handle and report stack not found errors', () => {
|
|
88
|
+
const error = new Error('Stack does not exist');
|
|
89
|
+
output.error('An error occurred:', error);
|
|
90
|
+
|
|
91
|
+
expect(output.error).toHaveBeenCalledWith('An error occurred:', error);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('should handle and report import validation errors', () => {
|
|
95
|
+
output.log('\nValidation errors:');
|
|
96
|
+
output.log(' • Resource1: Invalid property');
|
|
97
|
+
|
|
98
|
+
expect(output.log).toHaveBeenCalledWith('\nValidation errors:');
|
|
99
|
+
expect(output.log).toHaveBeenCalledWith(expect.stringContaining('Invalid property'));
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('should handle and report AWS API errors', () => {
|
|
103
|
+
const error = new Error('AccessDenied: Insufficient permissions');
|
|
104
|
+
output.error('An error occurred:', error);
|
|
105
|
+
|
|
106
|
+
expect(output.error).toHaveBeenCalledWith('An error occurred:', error);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe('User workflow scenarios', () => {
|
|
111
|
+
test('should report when no orphaned resources are found', () => {
|
|
112
|
+
output.success(' No orphaned resources to import');
|
|
113
|
+
|
|
114
|
+
expect(output.success).toHaveBeenCalled();
|
|
115
|
+
expect(output.success).toHaveBeenCalledWith(
|
|
116
|
+
expect.stringContaining('No orphaned resources')
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test('should list orphaned resources before import', () => {
|
|
121
|
+
output.info('📦 Found 3 orphaned resource(s) to import:');
|
|
122
|
+
output.log(' 1. AWS::Lambda::Function - my-function');
|
|
123
|
+
output.log(' 2. AWS::S3::Bucket - my-bucket');
|
|
124
|
+
output.log(' 3. AWS::DynamoDB::Table - my-table');
|
|
125
|
+
|
|
126
|
+
expect(output.info).toHaveBeenCalledWith(
|
|
127
|
+
expect.stringMatching(/Found \d+ orphaned/)
|
|
128
|
+
);
|
|
129
|
+
expect(output.log).toHaveBeenCalledTimes(3);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('should warn when build template is missing', () => {
|
|
133
|
+
output.warn('️ Build template not found. Generating sequential logical IDs (not recommended).');
|
|
134
|
+
output.log(' Run one of the following to generate build template:');
|
|
135
|
+
output.log(' • serverless package');
|
|
136
|
+
|
|
137
|
+
expect(output.warn).toHaveBeenCalledWith(
|
|
138
|
+
expect.stringContaining('Build template not found')
|
|
139
|
+
);
|
|
140
|
+
expect(output.log).toHaveBeenCalledWith(
|
|
141
|
+
expect.stringContaining('serverless package')
|
|
142
|
+
);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
test('should confirm before performing import', async () => {
|
|
146
|
+
output.confirm.mockResolvedValue(true);
|
|
147
|
+
|
|
148
|
+
const confirmed = await output.confirm('Import 5 orphaned resource(s) with sequential IDs?');
|
|
149
|
+
|
|
150
|
+
expect(output.confirm).toHaveBeenCalled();
|
|
151
|
+
expect(confirmed).toBe(true);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test('should handle user cancellation gracefully', async () => {
|
|
155
|
+
output.confirm.mockResolvedValue(false);
|
|
156
|
+
|
|
157
|
+
const confirmed = await output.confirm('Import resources?');
|
|
158
|
+
if (!confirmed) {
|
|
159
|
+
output.log('Import cancelled');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
expect(output.confirm).toHaveBeenCalled();
|
|
163
|
+
expect(output.log).toHaveBeenCalledWith('Import cancelled');
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test('should report successful import results', () => {
|
|
167
|
+
output.success(' Successfully imported 5 resource(s)');
|
|
168
|
+
|
|
169
|
+
expect(output.success).toHaveBeenCalledWith(
|
|
170
|
+
expect.stringMatching(/Successfully imported \d+/)
|
|
171
|
+
);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
describe('Repair workflow stages', () => {
|
|
176
|
+
test('should progress through health check stage', () => {
|
|
177
|
+
output.info('🏥 Running health check on stack...');
|
|
178
|
+
|
|
179
|
+
expect(output.info).toHaveBeenCalledWith(
|
|
180
|
+
expect.stringContaining('health check')
|
|
181
|
+
);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
test('should progress through import stage', () => {
|
|
185
|
+
output.info('🔧 Importing resources with sequential IDs...');
|
|
186
|
+
|
|
187
|
+
expect(output.info).toHaveBeenCalledWith(
|
|
188
|
+
expect.stringContaining('Importing resources')
|
|
189
|
+
);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
test('should progress through reconciliation stage', () => {
|
|
193
|
+
output.info('🔄 Reconciling property drift...');
|
|
194
|
+
|
|
195
|
+
expect(output.info).toHaveBeenCalledWith(
|
|
196
|
+
expect.stringContaining('Reconciling')
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
test('should report completion with summary', () => {
|
|
201
|
+
output.success(' Repair completed successfully');
|
|
202
|
+
output.log('\nSummary:');
|
|
203
|
+
output.log(' • Imported: 5 resources');
|
|
204
|
+
output.log(' • Reconciled: 3 properties');
|
|
205
|
+
|
|
206
|
+
expect(output.success).toHaveBeenCalledWith(
|
|
207
|
+
expect.stringContaining('completed successfully')
|
|
208
|
+
);
|
|
209
|
+
expect(output.log).toHaveBeenCalledWith('\nSummary:');
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
describe('Output consistency', () => {
|
|
214
|
+
test('should not use console.log directly', () => {
|
|
215
|
+
// Verify that all logging goes through output module
|
|
216
|
+
const consoleLogSpy = jest.spyOn(console, 'log');
|
|
217
|
+
|
|
218
|
+
output.log('Test message');
|
|
219
|
+
|
|
220
|
+
// output.log may call console.log internally, but command code shouldn't
|
|
221
|
+
expect(output.log).toHaveBeenCalled();
|
|
222
|
+
|
|
223
|
+
consoleLogSpy.mockRestore();
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
test('should not use console.error directly', () => {
|
|
227
|
+
// Verify that all errors go through output module
|
|
228
|
+
const consoleErrorSpy = jest.spyOn(console, 'error');
|
|
229
|
+
|
|
230
|
+
const error = new Error('Test error');
|
|
231
|
+
output.error('An error occurred:', error);
|
|
232
|
+
|
|
233
|
+
// output.error may call console.error internally, but command code shouldn't
|
|
234
|
+
expect(output.error).toHaveBeenCalled();
|
|
235
|
+
|
|
236
|
+
consoleErrorSpy.mockRestore();
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
test('should use consistent emoji patterns', () => {
|
|
240
|
+
// Verify emoji usage follows patterns
|
|
241
|
+
output.success(' Success message'); // ✓ or ✅
|
|
242
|
+
output.error(' Error message'); // ✗ or ❌
|
|
243
|
+
output.warn('️ Warning message'); // ⚠️
|
|
244
|
+
output.info('🔍 Info message'); // Various info emojis
|
|
245
|
+
|
|
246
|
+
expect(output.success).toHaveBeenCalled();
|
|
247
|
+
expect(output.error).toHaveBeenCalled();
|
|
248
|
+
expect(output.warn).toHaveBeenCalled();
|
|
249
|
+
expect(output.info).toHaveBeenCalled();
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
describe('Migration verification', () => {
|
|
254
|
+
test('should have migrated all console.log calls', () => {
|
|
255
|
+
// This test verifies the migration was complete
|
|
256
|
+
// In the actual command file, there should be 0 console.log references
|
|
257
|
+
expect(output.log).toBeDefined();
|
|
258
|
+
expect(output.info).toBeDefined();
|
|
259
|
+
expect(output.success).toBeDefined();
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
test('should have migrated all console.error calls', () => {
|
|
263
|
+
// This test verifies the migration was complete
|
|
264
|
+
// In the actual command file, there should be 0 console.error references
|
|
265
|
+
expect(output.error).toBeDefined();
|
|
266
|
+
expect(output.warn).toBeDefined();
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
test('should have migrated readline confirm to output.confirm', () => {
|
|
270
|
+
// This test verifies readline was replaced with output.confirm
|
|
271
|
+
expect(output.confirm).toBeDefined();
|
|
272
|
+
expect(typeof output.confirm).toBe('function');
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
});
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RunPreflightChecksUseCase Tests
|
|
3
|
+
* Orchestrates pre-flight checks before starting Frigg
|
|
4
|
+
*
|
|
5
|
+
* Tests follow TDD pattern - written BEFORE implementation
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { RunPreflightChecksUseCase } = require('../../../../start-command/application/RunPreflightChecksUseCase');
|
|
9
|
+
|
|
10
|
+
describe('RunPreflightChecksUseCase', () => {
|
|
11
|
+
let useCase;
|
|
12
|
+
let mockDockerAdapter;
|
|
13
|
+
let mockDatabaseAdapter;
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
jest.clearAllMocks();
|
|
17
|
+
|
|
18
|
+
// Reset environment
|
|
19
|
+
delete process.env.DATABASE_URL;
|
|
20
|
+
|
|
21
|
+
mockDockerAdapter = {
|
|
22
|
+
isDockerInstalled: jest.fn(),
|
|
23
|
+
isDockerRunning: jest.fn(),
|
|
24
|
+
findDockerComposeFile: jest.fn(),
|
|
25
|
+
startDockerDesktop: jest.fn(),
|
|
26
|
+
startDockerCompose: jest.fn(),
|
|
27
|
+
waitForDockerReady: jest.fn(),
|
|
28
|
+
waitForLocalStack: jest.fn()
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
mockDatabaseAdapter = {
|
|
32
|
+
getDatabaseType: jest.fn(),
|
|
33
|
+
isDatabaseReachable: jest.fn(),
|
|
34
|
+
getConnectionDetails: jest.fn()
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
useCase = new RunPreflightChecksUseCase({
|
|
38
|
+
dockerAdapter: mockDockerAdapter,
|
|
39
|
+
databaseAdapter: mockDatabaseAdapter
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('execute() - All checks pass', () => {
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
process.env.DATABASE_URL = 'mongodb://localhost:27017/frigg';
|
|
46
|
+
mockDockerAdapter.isDockerInstalled.mockResolvedValue(true);
|
|
47
|
+
mockDockerAdapter.isDockerRunning.mockResolvedValue(true);
|
|
48
|
+
mockDockerAdapter.findDockerComposeFile.mockResolvedValue('/test/docker-compose.yml');
|
|
49
|
+
mockDockerAdapter.waitForLocalStack.mockResolvedValue({ ready: true });
|
|
50
|
+
mockDatabaseAdapter.getDatabaseType.mockReturnValue('mongodb');
|
|
51
|
+
mockDatabaseAdapter.isDatabaseReachable.mockResolvedValue({ reachable: true });
|
|
52
|
+
mockDatabaseAdapter.getConnectionDetails.mockReturnValue({
|
|
53
|
+
type: 'mongodb',
|
|
54
|
+
host: 'localhost',
|
|
55
|
+
port: 27017,
|
|
56
|
+
database: 'frigg'
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should return all checks passed when everything is ready', async () => {
|
|
61
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
62
|
+
|
|
63
|
+
expect(result.allPassed).toBe(true);
|
|
64
|
+
// 5 checks: DATABASE_URL, docker_installed, docker_running, database_reachable, localstack_reachable
|
|
65
|
+
expect(result.checks).toHaveLength(5);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should include DATABASE_URL check result', async () => {
|
|
69
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
70
|
+
|
|
71
|
+
const dbUrlCheck = result.checks.find(c => c.name === 'database_url');
|
|
72
|
+
expect(dbUrlCheck.status).toBe('passed');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should include Docker installed check result', async () => {
|
|
76
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
77
|
+
|
|
78
|
+
const dockerCheck = result.checks.find(c => c.name === 'docker_installed');
|
|
79
|
+
expect(dockerCheck.status).toBe('passed');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('should include Docker running check result', async () => {
|
|
83
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
84
|
+
|
|
85
|
+
const dockerRunningCheck = result.checks.find(c => c.name === 'docker_running');
|
|
86
|
+
expect(dockerRunningCheck.status).toBe('passed');
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('should include database reachable check result', async () => {
|
|
90
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
91
|
+
|
|
92
|
+
const dbCheck = result.checks.find(c => c.name === 'database_reachable');
|
|
93
|
+
expect(dbCheck.status).toBe('passed');
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
describe('execute() - DATABASE_URL check', () => {
|
|
98
|
+
it('should fail when DATABASE_URL is not set', async () => {
|
|
99
|
+
delete process.env.DATABASE_URL;
|
|
100
|
+
|
|
101
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
102
|
+
|
|
103
|
+
expect(result.allPassed).toBe(false);
|
|
104
|
+
const dbUrlCheck = result.checks.find(c => c.name === 'database_url');
|
|
105
|
+
expect(dbUrlCheck.status).toBe('failed');
|
|
106
|
+
expect(dbUrlCheck.message).toContain('DATABASE_URL');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('should provide resolution option for missing DATABASE_URL', async () => {
|
|
110
|
+
delete process.env.DATABASE_URL;
|
|
111
|
+
|
|
112
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
113
|
+
|
|
114
|
+
const dbUrlCheck = result.checks.find(c => c.name === 'database_url');
|
|
115
|
+
expect(dbUrlCheck.canResolve).toBe(true);
|
|
116
|
+
expect(dbUrlCheck.resolution.type).toBe('create_env');
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('should pass when DATABASE_URL is set', async () => {
|
|
120
|
+
process.env.DATABASE_URL = 'mongodb://localhost:27017/frigg';
|
|
121
|
+
mockDatabaseAdapter.getDatabaseType.mockReturnValue('mongodb');
|
|
122
|
+
|
|
123
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
124
|
+
|
|
125
|
+
const dbUrlCheck = result.checks.find(c => c.name === 'database_url');
|
|
126
|
+
expect(dbUrlCheck.status).toBe('passed');
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
describe('execute() - Docker installed check', () => {
|
|
131
|
+
beforeEach(() => {
|
|
132
|
+
process.env.DATABASE_URL = 'mongodb://localhost:27017/frigg';
|
|
133
|
+
mockDatabaseAdapter.getDatabaseType.mockReturnValue('mongodb');
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('should fail when Docker is not installed', async () => {
|
|
137
|
+
mockDockerAdapter.isDockerInstalled.mockResolvedValue(false);
|
|
138
|
+
|
|
139
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
140
|
+
|
|
141
|
+
const dockerCheck = result.checks.find(c => c.name === 'docker_installed');
|
|
142
|
+
expect(dockerCheck.status).toBe('failed');
|
|
143
|
+
expect(dockerCheck.message).toContain('Docker is not installed');
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('should not provide auto-resolution for Docker not installed', async () => {
|
|
147
|
+
mockDockerAdapter.isDockerInstalled.mockResolvedValue(false);
|
|
148
|
+
|
|
149
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
150
|
+
|
|
151
|
+
const dockerCheck = result.checks.find(c => c.name === 'docker_installed');
|
|
152
|
+
expect(dockerCheck.canResolve).toBe(false);
|
|
153
|
+
expect(dockerCheck.resolution.type).toBe('manual');
|
|
154
|
+
expect(dockerCheck.resolution.instructions).toBeDefined();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('should pass when Docker is installed', async () => {
|
|
158
|
+
mockDockerAdapter.isDockerInstalled.mockResolvedValue(true);
|
|
159
|
+
mockDockerAdapter.isDockerRunning.mockResolvedValue(true);
|
|
160
|
+
mockDockerAdapter.waitForLocalStack.mockResolvedValue({ ready: true });
|
|
161
|
+
mockDatabaseAdapter.isDatabaseReachable.mockResolvedValue({ reachable: true });
|
|
162
|
+
|
|
163
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
164
|
+
|
|
165
|
+
const dockerCheck = result.checks.find(c => c.name === 'docker_installed');
|
|
166
|
+
expect(dockerCheck.status).toBe('passed');
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
describe('execute() - Docker running check', () => {
|
|
171
|
+
beforeEach(() => {
|
|
172
|
+
process.env.DATABASE_URL = 'mongodb://localhost:27017/frigg';
|
|
173
|
+
mockDatabaseAdapter.getDatabaseType.mockReturnValue('mongodb');
|
|
174
|
+
mockDockerAdapter.isDockerInstalled.mockResolvedValue(true);
|
|
175
|
+
mockDockerAdapter.waitForLocalStack.mockResolvedValue({ ready: true });
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('should fail when Docker daemon is not running', async () => {
|
|
179
|
+
mockDockerAdapter.isDockerRunning.mockResolvedValue(false);
|
|
180
|
+
|
|
181
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
182
|
+
|
|
183
|
+
const dockerRunningCheck = result.checks.find(c => c.name === 'docker_running');
|
|
184
|
+
expect(dockerRunningCheck.status).toBe('failed');
|
|
185
|
+
expect(dockerRunningCheck.message).toContain('Docker is not running');
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it('should provide resolution option to start Docker', async () => {
|
|
189
|
+
mockDockerAdapter.isDockerRunning.mockResolvedValue(false);
|
|
190
|
+
|
|
191
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
192
|
+
|
|
193
|
+
const dockerRunningCheck = result.checks.find(c => c.name === 'docker_running');
|
|
194
|
+
expect(dockerRunningCheck.canResolve).toBe(true);
|
|
195
|
+
expect(dockerRunningCheck.resolution.type).toBe('start_docker');
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it('should pass when Docker is running', async () => {
|
|
199
|
+
mockDockerAdapter.isDockerRunning.mockResolvedValue(true);
|
|
200
|
+
mockDockerAdapter.waitForLocalStack.mockResolvedValue({ ready: true });
|
|
201
|
+
mockDatabaseAdapter.isDatabaseReachable.mockResolvedValue({ reachable: true });
|
|
202
|
+
|
|
203
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
204
|
+
|
|
205
|
+
const dockerRunningCheck = result.checks.find(c => c.name === 'docker_running');
|
|
206
|
+
expect(dockerRunningCheck.status).toBe('passed');
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
describe('execute() - Database reachable check', () => {
|
|
211
|
+
beforeEach(() => {
|
|
212
|
+
process.env.DATABASE_URL = 'mongodb://localhost:27017/frigg';
|
|
213
|
+
mockDatabaseAdapter.getDatabaseType.mockReturnValue('mongodb');
|
|
214
|
+
mockDockerAdapter.isDockerInstalled.mockResolvedValue(true);
|
|
215
|
+
mockDockerAdapter.isDockerRunning.mockResolvedValue(true);
|
|
216
|
+
mockDockerAdapter.waitForLocalStack.mockResolvedValue({ ready: true });
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it('should fail when database is not reachable', async () => {
|
|
220
|
+
mockDatabaseAdapter.isDatabaseReachable.mockResolvedValue({
|
|
221
|
+
reachable: false,
|
|
222
|
+
error: 'ECONNREFUSED'
|
|
223
|
+
});
|
|
224
|
+
mockDockerAdapter.findDockerComposeFile.mockResolvedValue('/test/docker-compose.yml');
|
|
225
|
+
|
|
226
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
227
|
+
|
|
228
|
+
const dbCheck = result.checks.find(c => c.name === 'database_reachable');
|
|
229
|
+
expect(dbCheck.status).toBe('failed');
|
|
230
|
+
expect(dbCheck.message).toContain('Database is not reachable');
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it('should provide docker-compose resolution when file exists', async () => {
|
|
234
|
+
mockDatabaseAdapter.isDatabaseReachable.mockResolvedValue({
|
|
235
|
+
reachable: false,
|
|
236
|
+
error: 'ECONNREFUSED'
|
|
237
|
+
});
|
|
238
|
+
mockDockerAdapter.findDockerComposeFile.mockResolvedValue('/test/docker-compose.yml');
|
|
239
|
+
|
|
240
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
241
|
+
|
|
242
|
+
const dbCheck = result.checks.find(c => c.name === 'database_reachable');
|
|
243
|
+
expect(dbCheck.canResolve).toBe(true);
|
|
244
|
+
expect(dbCheck.resolution.type).toBe('start_docker_compose');
|
|
245
|
+
expect(dbCheck.resolution.composePath).toBe('/test/docker-compose.yml');
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
it('should suggest manual setup when no docker-compose exists', async () => {
|
|
249
|
+
mockDatabaseAdapter.isDatabaseReachable.mockResolvedValue({
|
|
250
|
+
reachable: false,
|
|
251
|
+
error: 'ECONNREFUSED'
|
|
252
|
+
});
|
|
253
|
+
mockDockerAdapter.findDockerComposeFile.mockResolvedValue(null);
|
|
254
|
+
|
|
255
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
256
|
+
|
|
257
|
+
const dbCheck = result.checks.find(c => c.name === 'database_reachable');
|
|
258
|
+
expect(dbCheck.canResolve).toBe(false);
|
|
259
|
+
expect(dbCheck.resolution.type).toBe('manual');
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it('should pass when database is reachable', async () => {
|
|
263
|
+
mockDatabaseAdapter.isDatabaseReachable.mockResolvedValue({ reachable: true });
|
|
264
|
+
|
|
265
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
266
|
+
|
|
267
|
+
const dbCheck = result.checks.find(c => c.name === 'database_reachable');
|
|
268
|
+
expect(dbCheck.status).toBe('passed');
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
describe('execute() - LocalStack reachable check', () => {
|
|
273
|
+
beforeEach(() => {
|
|
274
|
+
process.env.DATABASE_URL = 'mongodb://localhost:27017/frigg';
|
|
275
|
+
mockDatabaseAdapter.getDatabaseType.mockReturnValue('mongodb');
|
|
276
|
+
mockDockerAdapter.isDockerInstalled.mockResolvedValue(true);
|
|
277
|
+
mockDockerAdapter.isDockerRunning.mockResolvedValue(true);
|
|
278
|
+
mockDatabaseAdapter.isDatabaseReachable.mockResolvedValue({ reachable: true });
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it('should fail when LocalStack is not reachable', async () => {
|
|
282
|
+
mockDockerAdapter.waitForLocalStack.mockResolvedValue({ ready: false });
|
|
283
|
+
mockDockerAdapter.findDockerComposeFile.mockResolvedValue('/test/docker-compose.yml');
|
|
284
|
+
|
|
285
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
286
|
+
|
|
287
|
+
const localstackCheck = result.checks.find(c => c.name === 'localstack_reachable');
|
|
288
|
+
expect(localstackCheck.status).toBe('failed');
|
|
289
|
+
expect(localstackCheck.message).toContain('LocalStack is not reachable');
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
it('should provide docker-compose resolution when LocalStack is not reachable', async () => {
|
|
293
|
+
mockDockerAdapter.waitForLocalStack.mockResolvedValue({ ready: false });
|
|
294
|
+
mockDockerAdapter.findDockerComposeFile.mockResolvedValue('/test/docker-compose.yml');
|
|
295
|
+
|
|
296
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
297
|
+
|
|
298
|
+
const localstackCheck = result.checks.find(c => c.name === 'localstack_reachable');
|
|
299
|
+
expect(localstackCheck.canResolve).toBe(true);
|
|
300
|
+
expect(localstackCheck.resolution.type).toBe('start_docker_compose');
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
it('should pass when LocalStack is reachable', async () => {
|
|
304
|
+
mockDockerAdapter.waitForLocalStack.mockResolvedValue({ ready: true });
|
|
305
|
+
|
|
306
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
307
|
+
|
|
308
|
+
const localstackCheck = result.checks.find(c => c.name === 'localstack_reachable');
|
|
309
|
+
expect(localstackCheck.status).toBe('passed');
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
it('should skip LocalStack check when AWS_ENDPOINT points to real AWS', async () => {
|
|
313
|
+
process.env.AWS_ENDPOINT = 'https://sqs.us-east-1.amazonaws.com';
|
|
314
|
+
mockDockerAdapter.waitForLocalStack.mockResolvedValue({ ready: true });
|
|
315
|
+
|
|
316
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
317
|
+
|
|
318
|
+
// Should not include LocalStack check when using real AWS
|
|
319
|
+
const localstackCheck = result.checks.find(c => c.name === 'localstack_reachable');
|
|
320
|
+
expect(localstackCheck).toBeUndefined();
|
|
321
|
+
|
|
322
|
+
delete process.env.AWS_ENDPOINT;
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
describe('execute() - Short-circuit behavior', () => {
|
|
327
|
+
it('should skip Docker checks if DATABASE_URL is missing', async () => {
|
|
328
|
+
delete process.env.DATABASE_URL;
|
|
329
|
+
|
|
330
|
+
await useCase.execute({ projectPath: '/test/project' });
|
|
331
|
+
|
|
332
|
+
// Docker checks should not be called since DATABASE_URL failed
|
|
333
|
+
expect(mockDockerAdapter.isDockerInstalled).not.toHaveBeenCalled();
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
it('should skip Docker running check if Docker not installed', async () => {
|
|
337
|
+
process.env.DATABASE_URL = 'mongodb://localhost:27017/frigg';
|
|
338
|
+
mockDatabaseAdapter.getDatabaseType.mockReturnValue('mongodb');
|
|
339
|
+
mockDockerAdapter.isDockerInstalled.mockResolvedValue(false);
|
|
340
|
+
|
|
341
|
+
await useCase.execute({ projectPath: '/test/project' });
|
|
342
|
+
|
|
343
|
+
expect(mockDockerAdapter.isDockerRunning).not.toHaveBeenCalled();
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
it('should skip database reachable check if Docker not running', async () => {
|
|
347
|
+
process.env.DATABASE_URL = 'mongodb://localhost:27017/frigg';
|
|
348
|
+
mockDatabaseAdapter.getDatabaseType.mockReturnValue('mongodb');
|
|
349
|
+
mockDockerAdapter.isDockerInstalled.mockResolvedValue(true);
|
|
350
|
+
mockDockerAdapter.isDockerRunning.mockResolvedValue(false);
|
|
351
|
+
|
|
352
|
+
await useCase.execute({ projectPath: '/test/project' });
|
|
353
|
+
|
|
354
|
+
expect(mockDatabaseAdapter.isDatabaseReachable).not.toHaveBeenCalled();
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
describe('getFailedChecks()', () => {
|
|
359
|
+
it('should return only failed checks', async () => {
|
|
360
|
+
process.env.DATABASE_URL = 'mongodb://localhost:27017/frigg';
|
|
361
|
+
mockDatabaseAdapter.getDatabaseType.mockReturnValue('mongodb');
|
|
362
|
+
mockDockerAdapter.isDockerInstalled.mockResolvedValue(true);
|
|
363
|
+
mockDockerAdapter.isDockerRunning.mockResolvedValue(false);
|
|
364
|
+
|
|
365
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
366
|
+
const failed = useCase.getFailedChecks(result);
|
|
367
|
+
|
|
368
|
+
expect(failed).toHaveLength(1);
|
|
369
|
+
expect(failed[0].name).toBe('docker_running');
|
|
370
|
+
});
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
describe('getResolvableChecks()', () => {
|
|
374
|
+
it('should return only checks that can be auto-resolved', async () => {
|
|
375
|
+
process.env.DATABASE_URL = 'mongodb://localhost:27017/frigg';
|
|
376
|
+
mockDatabaseAdapter.getDatabaseType.mockReturnValue('mongodb');
|
|
377
|
+
mockDockerAdapter.isDockerInstalled.mockResolvedValue(true);
|
|
378
|
+
mockDockerAdapter.isDockerRunning.mockResolvedValue(false);
|
|
379
|
+
|
|
380
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
381
|
+
const resolvable = useCase.getResolvableChecks(result);
|
|
382
|
+
|
|
383
|
+
expect(resolvable).toHaveLength(1);
|
|
384
|
+
expect(resolvable[0].canResolve).toBe(true);
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
describe('Check result structure', () => {
|
|
389
|
+
it('should include all required fields in check results', async () => {
|
|
390
|
+
delete process.env.DATABASE_URL;
|
|
391
|
+
|
|
392
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
393
|
+
|
|
394
|
+
const check = result.checks[0];
|
|
395
|
+
expect(check).toHaveProperty('name');
|
|
396
|
+
expect(check).toHaveProperty('status');
|
|
397
|
+
expect(check).toHaveProperty('message');
|
|
398
|
+
expect(check).toHaveProperty('canResolve');
|
|
399
|
+
expect(check).toHaveProperty('resolution');
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
it('should include resolution details for failed checks', async () => {
|
|
403
|
+
delete process.env.DATABASE_URL;
|
|
404
|
+
|
|
405
|
+
const result = await useCase.execute({ projectPath: '/test/project' });
|
|
406
|
+
|
|
407
|
+
const check = result.checks.find(c => c.name === 'database_url');
|
|
408
|
+
expect(check.resolution).toHaveProperty('type');
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
});
|