@hz-9/a5-core 0.2.0-alpha.1

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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/dist/all.d.ts +676 -0
  4. package/dist/const/index.d.ts +38 -0
  5. package/dist/const/index.js +46 -0
  6. package/dist/core/__import-reflect-metadata.d.ts +1 -0
  7. package/dist/core/__import-reflect-metadata.js +4 -0
  8. package/dist/core/a5-application.d.ts +154 -0
  9. package/dist/core/a5-application.js +315 -0
  10. package/dist/core/a5-console-logger.d.ts +163 -0
  11. package/dist/core/a5-console-logger.js +354 -0
  12. package/dist/core/a5-factory.d.ts +21 -0
  13. package/dist/core/a5-factory.js +49 -0
  14. package/dist/core/index.d.ts +3 -0
  15. package/dist/core/index.js +20 -0
  16. package/dist/index.d.ts +7 -0
  17. package/dist/index.js +24 -0
  18. package/dist/interface/base.d.ts +18 -0
  19. package/dist/interface/base.js +3 -0
  20. package/dist/interface/http.d.ts +16 -0
  21. package/dist/interface/http.js +3 -0
  22. package/dist/interface/index.d.ts +3 -0
  23. package/dist/interface/index.js +20 -0
  24. package/dist/interface/provide-token.d.ts +21 -0
  25. package/dist/interface/provide-token.js +3 -0
  26. package/dist/middleware/a5-console-logger.middleware.d.ts +9 -0
  27. package/dist/middleware/a5-console-logger.middleware.js +58 -0
  28. package/dist/middleware/index.d.ts +1 -0
  29. package/dist/middleware/index.js +18 -0
  30. package/dist/module/config/index.d.ts +18 -0
  31. package/dist/module/config/index.js +36 -0
  32. package/dist/module/config/interface.d.ts +9 -0
  33. package/dist/module/config/interface.js +15 -0
  34. package/dist/module/index.d.ts +2 -0
  35. package/dist/module/index.js +19 -0
  36. package/dist/module/log/index.d.ts +18 -0
  37. package/dist/module/log/index.js +44 -0
  38. package/dist/module/log/interface.d.ts +9 -0
  39. package/dist/module/log/interface.js +15 -0
  40. package/dist/plugins/index.d.ts +1 -0
  41. package/dist/plugins/index.js +18 -0
  42. package/dist/plugins/nanoid.d.ts +1 -0
  43. package/dist/plugins/nanoid.js +6 -0
  44. package/dist/test/integration/core/a5-factory.integration.spec.d.ts +1 -0
  45. package/dist/test/integration/core/a5-factory.integration.spec.js +99 -0
  46. package/dist/test/integration/core/with-logger-module.integration.spec.d.ts +1 -0
  47. package/dist/test/integration/core/with-logger-module.integration.spec.js +401 -0
  48. package/dist/test/unit/core/a5-application.unit.spec.d.ts +1 -0
  49. package/dist/test/unit/core/a5-application.unit.spec.js +450 -0
  50. package/dist/test/unit/core/a5-console-logger.unit.spec.d.ts +1 -0
  51. package/dist/test/unit/core/a5-console-logger.unit.spec.js +998 -0
  52. package/dist/test/unit/middleware/a5-console-logger.middleware.unit.spec.d.ts +1 -0
  53. package/dist/test/unit/middleware/a5-console-logger.middleware.unit.spec.js +379 -0
  54. package/dist/test/unit/util/a5.util.unit.spec.d.ts +1 -0
  55. package/dist/test/unit/util/a5.util.unit.spec.js +109 -0
  56. package/dist/test/unit/util/color.util.unit.spec.d.ts +1 -0
  57. package/dist/test/unit/util/color.util.unit.spec.js +277 -0
  58. package/dist/test/unit/util/logo.util.unit.spec.d.ts +1 -0
  59. package/dist/test/unit/util/logo.util.unit.spec.js +202 -0
  60. package/dist/test/unit/util/run-env.util.unit.spec.d.ts +1 -0
  61. package/dist/test/unit/util/run-env.util.unit.spec.js +183 -0
  62. package/dist/util/a5.util.d.ts +27 -0
  63. package/dist/util/a5.util.js +41 -0
  64. package/dist/util/color.util.d.ts +26 -0
  65. package/dist/util/color.util.js +62 -0
  66. package/dist/util/index.d.ts +5 -0
  67. package/dist/util/index.js +22 -0
  68. package/dist/util/load-package.util.d.ts +29 -0
  69. package/dist/util/load-package.util.js +71 -0
  70. package/dist/util/logo.util.d.ts +31 -0
  71. package/dist/util/logo.util.js +59 -0
  72. package/dist/util/run-env.util.d.ts +28 -0
  73. package/dist/util/run-env.util.js +48 -0
  74. package/logo +7 -0
  75. package/package.json +96 -0
@@ -0,0 +1,450 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_1 = require("../../../const/index");
4
+ const a5_application_1 = require("../../../core/a5-application");
5
+ const a5_console_logger_1 = require("../../../core/a5-console-logger");
6
+ const util_1 = require("../../../util");
7
+ // Test helper class to access protected members
8
+ class TestableA5Application extends a5_application_1.A5Application {
9
+ getInitTime() {
10
+ return this.initTime;
11
+ }
12
+ getLogger() {
13
+ return this.logger;
14
+ }
15
+ getExtraUrls() {
16
+ return this.extraUrls;
17
+ }
18
+ }
19
+ describe('A5Application Unit Test', () => {
20
+ const originalEnv = process.env;
21
+ // eslint-disable-next-line init-declarations
22
+ let processStdoutWriteSpy;
23
+ // eslint-disable-next-line init-declarations
24
+ let processStderrWriteSpy;
25
+ // eslint-disable-next-line init-declarations
26
+ let app;
27
+ // eslint-disable-next-line init-declarations
28
+ let mockNestApp;
29
+ beforeEach(() => {
30
+ jest.resetModules();
31
+ process.env = { ...originalEnv };
32
+ processStdoutWriteSpy = jest.spyOn(process.stdout, 'write').mockImplementation();
33
+ processStderrWriteSpy = jest.spyOn(process.stderr, 'write').mockImplementation();
34
+ jest.clearAllMocks();
35
+ // Mock the Date.now() to ensure consistent timing
36
+ const mockDateNow = 1642780800000; // 2022-01-21 12:00:00 UTC
37
+ jest.spyOn(Date, 'now').mockReturnValue(mockDateNow);
38
+ process.env.A5_INIT_TIME = String(mockDateNow - 1000); // 1 second earlier
39
+ // Create mock NestFastifyApplication
40
+ mockNestApp = {
41
+ useLogger: jest.fn().mockReturnValue(undefined),
42
+ init: jest.fn().mockResolvedValue(undefined),
43
+ flushLogs: jest.fn().mockResolvedValue(undefined),
44
+ listen: jest.fn().mockResolvedValue(undefined),
45
+ getUrl: jest.fn().mockResolvedValue('http://localhost:3000'),
46
+ close: jest.fn().mockResolvedValue(undefined),
47
+ getHttpServer: jest.fn().mockReturnValue({
48
+ address: jest.fn().mockReturnValue({ port: 3000 }),
49
+ }),
50
+ get: jest.fn().mockImplementation((token) => {
51
+ if (token.toString().includes('ModuleRef')) {
52
+ return {
53
+ get: jest.fn().mockImplementation(() => {
54
+ throw new Error('Module not found');
55
+ }),
56
+ };
57
+ }
58
+ throw new Error('Unknown token');
59
+ }),
60
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
+ };
62
+ app = new TestableA5Application(mockNestApp);
63
+ });
64
+ afterEach(() => {
65
+ process.env = originalEnv;
66
+ processStdoutWriteSpy.mockRestore();
67
+ processStderrWriteSpy.mockRestore();
68
+ jest.restoreAllMocks();
69
+ });
70
+ describe('[[Constructor]]', () => {
71
+ describe('[[Constructor]]', () => {
72
+ describe('[[Default]]', () => {
73
+ it('should create instance with default options when no options provided', () => {
74
+ const testApp = new TestableA5Application(mockNestApp);
75
+ expect(testApp).toBeInstanceOf(a5_application_1.A5Application);
76
+ expect(testApp.instanceId).toBeDefined();
77
+ expect(testApp.instanceId).toHaveLength(21);
78
+ expect(testApp.nestApp).toBe(mockNestApp);
79
+ expect(testApp.options.logger).toBeDefined();
80
+ });
81
+ it('should create instance with empty options object', () => {
82
+ const testApp = new TestableA5Application(mockNestApp, {});
83
+ expect(testApp).toBeInstanceOf(a5_application_1.A5Application);
84
+ expect(testApp.options.logger).toBeDefined();
85
+ });
86
+ });
87
+ describe('nestApp', () => {
88
+ it('should accept NestFastifyApplication instance', () => {
89
+ const testApp = new TestableA5Application(mockNestApp);
90
+ expect(testApp.nestApp).toBe(mockNestApp);
91
+ });
92
+ it('should preserve all methods of nested app', () => {
93
+ const testApp = new TestableA5Application(mockNestApp);
94
+ expect(testApp.nestApp.init).toBeDefined();
95
+ expect(testApp.nestApp.listen).toBeDefined();
96
+ expect(testApp.nestApp.close).toBeDefined();
97
+ });
98
+ });
99
+ describe('options', () => {
100
+ it('should use provided logger when specified', () => {
101
+ const customLogger = new a5_console_logger_1.A5ConsoleLogger({ context: 'Custom' });
102
+ const testApp = new TestableA5Application(mockNestApp, { logger: customLogger });
103
+ expect(testApp.options.logger).toBe(customLogger);
104
+ });
105
+ it('should use default logger when logger not provided', () => {
106
+ const testApp = new TestableA5Application(mockNestApp, {});
107
+ expect(testApp.options.logger).toBeDefined();
108
+ expect(testApp.options.logger).toBeInstanceOf(a5_console_logger_1.A5ConsoleLogger);
109
+ });
110
+ it('should handle undefined options', () => {
111
+ const testApp = new TestableA5Application(mockNestApp, undefined);
112
+ expect(testApp.options.logger).toBeDefined();
113
+ });
114
+ });
115
+ });
116
+ });
117
+ describe('[[Protected Properties]]', () => {
118
+ describe('[[Properties]]', () => {
119
+ describe('logger', () => {
120
+ it('should be initialized with A5Application name', () => {
121
+ const logger = app.getLogger();
122
+ expect(logger).toBeDefined();
123
+ expect(logger.constructor.name).toBe('Logger');
124
+ });
125
+ it('should be accessible through test helper', () => {
126
+ const logger = app.getLogger();
127
+ expect(logger).toBeDefined();
128
+ });
129
+ });
130
+ describe('extraUrls', () => {
131
+ it('should be empty array initially', () => {
132
+ const extraUrls = app.getExtraUrls();
133
+ expect(extraUrls).toEqual([]);
134
+ expect(Array.isArray(extraUrls)).toBe(true);
135
+ });
136
+ it('should be modifiable', () => {
137
+ const extraUrls = app.getExtraUrls();
138
+ extraUrls.push('test-url');
139
+ expect(app.getExtraUrls()).toContain('test-url');
140
+ });
141
+ });
142
+ });
143
+ });
144
+ describe('[[Public Properties]]', () => {
145
+ describe('[[Properties]]', () => {
146
+ describe('instanceId', () => {
147
+ it('should be a 21-character string generated by nanoid', () => {
148
+ expect(app.instanceId).toBeDefined();
149
+ expect(typeof app.instanceId).toBe('string');
150
+ expect(app.instanceId).toHaveLength(21);
151
+ });
152
+ it('should be unique for each instance', () => {
153
+ const app1 = new TestableA5Application(mockNestApp);
154
+ const app2 = new TestableA5Application(mockNestApp);
155
+ expect(app1.instanceId).not.toBe(app2.instanceId);
156
+ });
157
+ it('should contain only valid nanoid characters', () => {
158
+ expect(app.instanceId).toMatch(/^[A-Za-z0-9_-]+$/);
159
+ });
160
+ });
161
+ describe('nestApp', () => {
162
+ it('should be the same instance passed to constructor', () => {
163
+ expect(app.nestApp).toBe(mockNestApp);
164
+ });
165
+ it('should be readonly property', () => {
166
+ const originalNestApp = app.nestApp;
167
+ expect(app.nestApp).toBe(originalNestApp);
168
+ });
169
+ });
170
+ describe('options', () => {
171
+ it('should contain logger property', () => {
172
+ expect(app.options).toHaveProperty('logger');
173
+ expect(app.options.logger).toBeDefined();
174
+ });
175
+ it('should be readonly property', () => {
176
+ const originalOptions = app.options;
177
+ expect(app.options).toBe(originalOptions);
178
+ });
179
+ it('should be A5AppOptions type with logger', () => {
180
+ expect(app.options.logger).toBeDefined();
181
+ expect(typeof app.options.logger.log).toBe('function');
182
+ });
183
+ });
184
+ });
185
+ });
186
+ describe('[[Public Methods]]', () => {
187
+ describe('init', () => {
188
+ describe('[[Default]]', () => {
189
+ it('should initialize nest application with logger', async () => {
190
+ await app.init();
191
+ expect(mockNestApp.useLogger).toHaveBeenCalledWith(app.options.logger);
192
+ expect(mockNestApp.init).toHaveBeenCalled();
193
+ expect(mockNestApp.flushLogs).toHaveBeenCalled();
194
+ });
195
+ it('should call methods in correct order', async () => {
196
+ const callOrder = [];
197
+ mockNestApp.useLogger.mockImplementation(() => {
198
+ callOrder.push('useLogger');
199
+ return undefined;
200
+ });
201
+ mockNestApp.init.mockImplementation(jest.fn());
202
+ mockNestApp.flushLogs.mockImplementation(jest.fn());
203
+ await app.init();
204
+ expect(callOrder).toEqual(['useLogger']);
205
+ });
206
+ it('should handle init errors', async () => {
207
+ const error = new Error('Init failed');
208
+ mockNestApp.init.mockRejectedValue(error);
209
+ await expect(app.init()).rejects.toThrow('Init failed');
210
+ });
211
+ it('should handle flushLogs errors', async () => {
212
+ const error = new Error('FlushLogs failed');
213
+ mockNestApp.flushLogs.mockRejectedValue(error);
214
+ await expect(app.init()).rejects.toThrow('FlushLogs failed');
215
+ });
216
+ });
217
+ });
218
+ describe('listen', () => {
219
+ describe('[[Default]]', () => {
220
+ it('should listen on default port when no arguments provided', async () => {
221
+ await app.listen();
222
+ expect(mockNestApp.listen).toHaveBeenCalledWith(index_1.A5_APP_LISTEN_PORT_DEFAULT);
223
+ });
224
+ it('should use default options when no options provided', async () => {
225
+ const listenSpy = jest.spyOn(mockNestApp, 'listen');
226
+ await app.listen();
227
+ expect(listenSpy).toHaveBeenCalledWith(index_1.A5_APP_LISTEN_PORT_DEFAULT);
228
+ });
229
+ });
230
+ describe('port', () => {
231
+ it('should listen on specified numeric port', async () => {
232
+ await app.listen(8080);
233
+ expect(mockNestApp.listen).toHaveBeenCalledWith(8080);
234
+ });
235
+ it('should listen on specified string port', async () => {
236
+ await app.listen('8080');
237
+ expect(mockNestApp.listen).toHaveBeenCalledWith(8080);
238
+ });
239
+ it('should handle invalid string port', async () => {
240
+ await app.listen('invalid');
241
+ expect(mockNestApp.listen).toHaveBeenCalledWith(NaN);
242
+ });
243
+ });
244
+ describe('options', () => {
245
+ it('should use provided listen options', async () => {
246
+ const options = {
247
+ tryTimes: 5,
248
+ tryInterval: 2000,
249
+ autoExit: false,
250
+ };
251
+ await app.listen(options);
252
+ expect(mockNestApp.listen).toHaveBeenCalledWith(index_1.A5_APP_LISTEN_PORT_DEFAULT);
253
+ });
254
+ it('should merge port and options correctly', async () => {
255
+ const options = {
256
+ tryTimes: 3,
257
+ autoExit: true,
258
+ };
259
+ await app.listen(9000, options);
260
+ expect(mockNestApp.listen).toHaveBeenCalledWith(9000);
261
+ });
262
+ it('should use default values for undefined option properties', async () => {
263
+ const options = {
264
+ tryTimes: 2,
265
+ };
266
+ await app.listen(options);
267
+ expect(mockNestApp.listen).toHaveBeenCalledWith(index_1.A5_APP_LISTEN_PORT_DEFAULT);
268
+ });
269
+ });
270
+ describe('retryLogic', () => {
271
+ it('should retry when port is in use', async () => {
272
+ let callCount = 0;
273
+ mockNestApp.listen.mockImplementation(async () => {
274
+ callCount += 1;
275
+ if (callCount === 1) {
276
+ throw new Error('listen EADDRINUSE: address already in use');
277
+ }
278
+ });
279
+ const sleepSpy = jest.spyOn(util_1.A5Util, 'sleep').mockResolvedValue();
280
+ await app.listen({ tryTimes: 2, tryInterval: 100 });
281
+ expect(mockNestApp.listen).toHaveBeenCalledTimes(2);
282
+ expect(sleepSpy).toHaveBeenCalledWith(100);
283
+ sleepSpy.mockRestore();
284
+ });
285
+ it('should throw error when max retry attempts exceeded and autoExit is false', async () => {
286
+ // eslint-disable-next-line @typescript-eslint/no-extra-semi
287
+ ;
288
+ mockNestApp.listen.mockRejectedValue(new Error('listen EADDRINUSE: address already in use'));
289
+ await expect(app.listen({ tryTimes: 1, autoExit: false })).rejects.toThrow('A5Application.listen error: port 16100 has be used');
290
+ });
291
+ it('should call close when max retry attempts exceeded and autoExit is true', async () => {
292
+ // eslint-disable-next-line @typescript-eslint/no-extra-semi
293
+ ;
294
+ mockNestApp.listen.mockRejectedValue(new Error('listen EADDRINUSE: address already in use'));
295
+ await app.listen({ tryTimes: 1, autoExit: true });
296
+ expect(mockNestApp.close).toHaveBeenCalled();
297
+ });
298
+ });
299
+ });
300
+ describe('setExtraUrl', () => {
301
+ describe('[[Default]]', () => {
302
+ it('should add single URL to extraUrls array', async () => {
303
+ await app.setExtraUrl('http://example.com');
304
+ expect(app.getExtraUrls()).toContain('http://example.com');
305
+ });
306
+ it('should return undefined', async () => {
307
+ const result = await app.setExtraUrl('http://example.com');
308
+ expect(result).toBeUndefined();
309
+ });
310
+ });
311
+ describe('urlOrUrls', () => {
312
+ it('should add single string URL', async () => {
313
+ await app.setExtraUrl('http://single.com');
314
+ expect(app.getExtraUrls()).toEqual(['http://single.com']);
315
+ });
316
+ it('should add array of URLs', async () => {
317
+ const urls = ['http://first.com', 'http://second.com'];
318
+ await app.setExtraUrl(urls);
319
+ expect(app.getExtraUrls()).toEqual(urls);
320
+ });
321
+ it('should append URLs to existing extraUrls', async () => {
322
+ await app.setExtraUrl('http://first.com');
323
+ await app.setExtraUrl(['http://second.com', 'http://third.com']);
324
+ expect(app.getExtraUrls()).toEqual(['http://first.com', 'http://second.com', 'http://third.com']);
325
+ });
326
+ it('should handle empty array', async () => {
327
+ await app.setExtraUrl([]);
328
+ expect(app.getExtraUrls()).toEqual([]);
329
+ });
330
+ it('should handle empty string', async () => {
331
+ await app.setExtraUrl('');
332
+ expect(app.getExtraUrls()).toEqual(['']);
333
+ });
334
+ });
335
+ });
336
+ describe('getUrls', () => {
337
+ describe('[[Default]]', () => {
338
+ it('should return array containing nest app URL', async () => {
339
+ const urls = await app.getUrls();
340
+ expect(urls).toContain('http://localhost:3000');
341
+ expect(urls).toHaveLength(1);
342
+ });
343
+ it('should call nestApp.getUrl', async () => {
344
+ await app.getUrls();
345
+ expect(mockNestApp.getUrl).toHaveBeenCalled();
346
+ });
347
+ });
348
+ describe('extraUrls', () => {
349
+ it('should include extra URLs when present', async () => {
350
+ await app.setExtraUrl(['http://extra1.com', 'http://extra2.com']);
351
+ const urls = await app.getUrls();
352
+ expect(urls).toEqual(['http://localhost:3000', 'http://extra1.com', 'http://extra2.com']);
353
+ });
354
+ it('should maintain order with nest URL first', async () => {
355
+ await app.setExtraUrl('http://extra.com');
356
+ const urls = await app.getUrls();
357
+ expect(urls[0]).toBe('http://localhost:3000');
358
+ expect(urls[1]).toBe('http://extra.com');
359
+ });
360
+ it('should handle empty extra URLs', async () => {
361
+ const urls = await app.getUrls();
362
+ expect(urls).toEqual(['http://localhost:3000']);
363
+ });
364
+ });
365
+ });
366
+ describe('printAddress', () => {
367
+ describe('[[Default]]', () => {
368
+ it('should print application running message', async () => {
369
+ const loggerSpy = jest.spyOn(app.getLogger(), 'log');
370
+ await app.printAddress();
371
+ expect(loggerSpy).toHaveBeenCalledWith(expect.stringContaining('Application runing at'));
372
+ });
373
+ it('should include time difference in log message', async () => {
374
+ const loggerSpy = jest.spyOn(app.getLogger(), 'log');
375
+ await app.printAddress();
376
+ expect(loggerSpy).toHaveBeenCalledWith(expect.stringContaining('1000 ms'));
377
+ });
378
+ });
379
+ describe('urlFormatting', () => {
380
+ it('should pad URLs to align them properly', async () => {
381
+ await app.setExtraUrl('http://short.com');
382
+ const loggerSpy = jest.spyOn(app.getLogger(), 'log');
383
+ await app.printAddress();
384
+ // URLs should be padded to the same length
385
+ const { calls } = loggerSpy.mock;
386
+ expect(calls.length).toBeGreaterThan(1);
387
+ });
388
+ it('should print multiple URLs with proper spacing', async () => {
389
+ await app.setExtraUrl(['http://first.com', 'http://second-longer-url.com']);
390
+ const loggerSpy = jest.spyOn(app.getLogger(), 'log');
391
+ await app.printAddress();
392
+ expect(loggerSpy).toHaveBeenCalledTimes(3); // 1 main + 2 extra
393
+ });
394
+ it('should handle single URL without extra spacing', async () => {
395
+ const loggerSpy = jest.spyOn(app.getLogger(), 'log');
396
+ await app.printAddress();
397
+ expect(loggerSpy).toHaveBeenCalledTimes(1);
398
+ });
399
+ });
400
+ });
401
+ describe('close', () => {
402
+ describe('[[Default]]', () => {
403
+ it('should call nestApp.close', async () => {
404
+ await app.close();
405
+ expect(mockNestApp.close).toHaveBeenCalled();
406
+ });
407
+ it('should return Promise<void>', async () => {
408
+ const result = await app.close();
409
+ expect(result).toBeUndefined();
410
+ });
411
+ it('should handle close errors', async () => {
412
+ const error = new Error('Close failed');
413
+ mockNestApp.close.mockRejectedValue(error);
414
+ await expect(app.close()).rejects.toThrow('Close failed');
415
+ });
416
+ });
417
+ });
418
+ describe('isClose', () => {
419
+ describe('[[Default]]', () => {
420
+ it('should return false when server is running', () => {
421
+ mockNestApp.getHttpServer.mockReturnValue({
422
+ address: jest.fn().mockReturnValue({ port: 3000 }),
423
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
424
+ });
425
+ const result = app.isClose();
426
+ expect(result).toBe(false);
427
+ });
428
+ it('should return true when server address is null', () => {
429
+ mockNestApp.getHttpServer.mockReturnValue({
430
+ address: jest.fn().mockReturnValue(null),
431
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
432
+ });
433
+ const result = app.isClose();
434
+ expect(result).toBe(true);
435
+ });
436
+ it('should call getHttpServer and address methods', () => {
437
+ const mockAddress = jest.fn().mockReturnValue({ port: 3000 });
438
+ mockNestApp.getHttpServer.mockReturnValue({
439
+ address: mockAddress,
440
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
441
+ });
442
+ app.isClose();
443
+ expect(mockNestApp.getHttpServer).toHaveBeenCalled();
444
+ expect(mockAddress).toHaveBeenCalled();
445
+ });
446
+ });
447
+ });
448
+ });
449
+ });
450
+ //# sourceMappingURL=a5-application.unit.spec.js.map