create-fluxstack 1.0.13 → 1.0.15
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/.env.example +29 -29
- package/app/client/README.md +69 -69
- package/app/client/index.html +14 -13
- package/app/client/src/App.tsx +157 -524
- package/app/client/src/components/ErrorBoundary.tsx +107 -0
- package/app/client/src/components/ErrorDisplay.css +365 -0
- package/app/client/src/components/ErrorDisplay.tsx +258 -0
- package/app/client/src/components/FluxStackConfig.tsx +1321 -0
- package/app/client/src/components/HybridLiveCounter.tsx +140 -0
- package/app/client/src/components/LiveClock.tsx +286 -0
- package/app/client/src/components/MainLayout.tsx +390 -0
- package/app/client/src/components/SidebarNavigation.tsx +391 -0
- package/app/client/src/components/StateDemo.tsx +178 -0
- package/app/client/src/components/SystemMonitor.tsx +1038 -0
- package/app/client/src/components/Teste.tsx +104 -0
- package/app/client/src/components/UserProfile.tsx +809 -0
- package/app/client/src/hooks/useAuth.ts +39 -0
- package/app/client/src/hooks/useNotifications.ts +56 -0
- package/app/client/src/lib/eden-api.ts +189 -53
- package/app/client/src/lib/errors.ts +340 -0
- package/app/client/src/lib/hooks/useErrorHandler.ts +258 -0
- package/app/client/src/lib/index.ts +45 -0
- package/app/client/src/main.tsx +3 -2
- package/app/client/src/pages/ApiDocs.tsx +182 -0
- package/app/client/src/pages/Demo.tsx +174 -0
- package/app/client/src/pages/HybridLive.tsx +263 -0
- package/app/client/src/pages/Overview.tsx +155 -0
- package/app/client/src/store/README.md +43 -0
- package/app/client/src/store/index.ts +16 -0
- package/app/client/src/store/slices/uiSlice.ts +151 -0
- package/app/client/src/store/slices/userSlice.ts +161 -0
- package/app/client/src/test/README.md +257 -0
- package/app/client/src/test/setup.ts +70 -0
- package/app/client/src/test/types.ts +12 -0
- package/app/client/src/vite-env.d.ts +1 -1
- package/app/client/tsconfig.app.json +44 -43
- package/app/client/tsconfig.json +7 -7
- package/app/client/tsconfig.node.json +25 -25
- package/app/client/zustand-setup.md +65 -0
- package/app/server/controllers/users.controller.ts +68 -68
- package/app/server/index.ts +9 -1
- package/app/server/live/CounterComponent.ts +191 -0
- package/app/server/live/FluxStackConfig.ts +529 -0
- package/app/server/live/LiveClockComponent.ts +214 -0
- package/app/server/live/SidebarNavigation.ts +156 -0
- package/app/server/live/SystemMonitor.ts +594 -0
- package/app/server/live/SystemMonitorIntegration.ts +151 -0
- package/app/server/live/TesteComponent.ts +87 -0
- package/app/server/live/UserProfileComponent.ts +135 -0
- package/app/server/live/register-components.ts +28 -0
- package/app/server/middleware/auth.ts +136 -0
- package/app/server/middleware/errorHandling.ts +250 -0
- package/app/server/middleware/index.ts +10 -0
- package/app/server/middleware/rateLimit.ts +193 -0
- package/app/server/middleware/requestLogging.ts +215 -0
- package/app/server/middleware/validation.ts +270 -0
- package/app/server/routes/index.ts +14 -2
- package/app/server/routes/upload.ts +92 -0
- package/app/server/routes/users.routes.ts +2 -9
- package/app/server/services/NotificationService.ts +302 -0
- package/app/server/services/UserService.ts +222 -0
- package/app/server/services/index.ts +46 -0
- package/core/cli/commands/plugin-deps.ts +263 -0
- package/core/cli/generators/README.md +339 -0
- package/core/cli/generators/component.ts +770 -0
- package/core/cli/generators/controller.ts +299 -0
- package/core/cli/generators/index.ts +144 -0
- package/core/cli/generators/interactive.ts +228 -0
- package/core/cli/generators/prompts.ts +83 -0
- package/core/cli/generators/route.ts +513 -0
- package/core/cli/generators/service.ts +465 -0
- package/core/cli/generators/template-engine.ts +154 -0
- package/core/cli/generators/types.ts +71 -0
- package/core/cli/generators/utils.ts +192 -0
- package/core/cli/index.ts +69 -0
- package/core/cli/plugin-discovery.ts +16 -85
- package/core/client/fluxstack.ts +17 -0
- package/core/client/hooks/index.ts +7 -0
- package/core/client/hooks/state-validator.ts +130 -0
- package/core/client/hooks/useAuth.ts +49 -0
- package/core/client/hooks/useChunkedUpload.ts +258 -0
- package/core/client/hooks/useHybridLiveComponent.ts +967 -0
- package/core/client/hooks/useWebSocket.ts +373 -0
- package/core/client/index.ts +47 -0
- package/core/client/state/createStore.ts +193 -0
- package/core/client/state/index.ts +15 -0
- package/core/config/env-dynamic.ts +1 -1
- package/core/config/env.ts +2 -1
- package/core/config/runtime-config.ts +3 -3
- package/core/config/schema.ts +84 -49
- package/core/framework/server.ts +30 -0
- package/core/index.ts +25 -0
- package/core/live/ComponentRegistry.ts +399 -0
- package/core/live/types.ts +164 -0
- package/core/plugins/built-in/live-components/commands/create-live-component.ts +1201 -0
- package/core/plugins/built-in/live-components/index.ts +27 -0
- package/core/plugins/built-in/logger/index.ts +1 -1
- package/core/plugins/built-in/monitoring/index.ts +1 -1
- package/core/plugins/built-in/static/index.ts +1 -1
- package/core/plugins/built-in/swagger/index.ts +1 -1
- package/core/plugins/built-in/vite/index.ts +1 -1
- package/core/plugins/dependency-manager.ts +384 -0
- package/core/plugins/index.ts +5 -1
- package/core/plugins/manager.ts +7 -3
- package/core/plugins/registry.ts +88 -10
- package/core/plugins/types.ts +11 -11
- package/core/server/framework.ts +43 -0
- package/core/server/index.ts +11 -1
- package/core/server/live/ComponentRegistry.ts +1017 -0
- package/core/server/live/FileUploadManager.ts +272 -0
- package/core/server/live/LiveComponentPerformanceMonitor.ts +930 -0
- package/core/server/live/SingleConnectionManager.ts +0 -0
- package/core/server/live/StateSignature.ts +644 -0
- package/core/server/live/WebSocketConnectionManager.ts +688 -0
- package/core/server/live/websocket-plugin.ts +435 -0
- package/core/server/middleware/errorHandling.ts +141 -0
- package/core/server/middleware/index.ts +16 -0
- package/core/server/plugins/static-files-plugin.ts +232 -0
- package/core/server/services/BaseService.ts +95 -0
- package/core/server/services/ServiceContainer.ts +144 -0
- package/core/server/services/index.ts +9 -0
- package/core/templates/create-project.ts +196 -33
- package/core/testing/index.ts +10 -0
- package/core/testing/setup.ts +74 -0
- package/core/types/build.ts +38 -14
- package/core/types/types.ts +319 -0
- package/core/utils/env-runtime.ts +7 -0
- package/core/utils/errors/handlers.ts +264 -39
- package/core/utils/errors/index.ts +528 -18
- package/core/utils/errors/middleware.ts +114 -0
- package/core/utils/logger/formatters.ts +222 -0
- package/core/utils/logger/index.ts +167 -48
- package/core/utils/logger/middleware.ts +253 -0
- package/core/utils/logger/performance.ts +384 -0
- package/core/utils/logger/transports.ts +365 -0
- package/create-fluxstack.ts +296 -296
- package/fluxstack.config.ts +17 -1
- package/package-template.json +66 -66
- package/package.json +31 -6
- package/public/README.md +16 -0
- package/vite.config.ts +29 -14
- package/.claude/settings.local.json +0 -74
- package/.github/workflows/ci-build-tests.yml +0 -480
- package/.github/workflows/dependency-management.yml +0 -324
- package/.github/workflows/release-validation.yml +0 -355
- package/.kiro/specs/fluxstack-architecture-optimization/design.md +0 -700
- package/.kiro/specs/fluxstack-architecture-optimization/requirements.md +0 -127
- package/.kiro/specs/fluxstack-architecture-optimization/tasks.md +0 -330
- package/CLAUDE.md +0 -200
- package/Dockerfile +0 -58
- package/Dockerfile.backend +0 -52
- package/Dockerfile.frontend +0 -54
- package/README-Docker.md +0 -85
- package/ai-context/00-QUICK-START.md +0 -86
- package/ai-context/README.md +0 -88
- package/ai-context/development/eden-treaty-guide.md +0 -362
- package/ai-context/development/patterns.md +0 -382
- package/ai-context/development/plugins-guide.md +0 -572
- package/ai-context/examples/crud-complete.md +0 -626
- package/ai-context/project/architecture.md +0 -399
- package/ai-context/project/overview.md +0 -213
- package/ai-context/recent-changes/eden-treaty-refactor.md +0 -281
- package/ai-context/recent-changes/type-inference-fix.md +0 -223
- package/ai-context/reference/environment-vars.md +0 -384
- package/ai-context/reference/troubleshooting.md +0 -407
- package/app/client/src/components/TestPage.tsx +0 -453
- package/bun.lock +0 -1063
- package/bunfig.toml +0 -16
- package/core/__tests__/integration.test.ts +0 -227
- package/core/build/index.ts +0 -186
- package/core/config/__tests__/config-loader.test.ts +0 -554
- package/core/config/__tests__/config-merger.test.ts +0 -657
- package/core/config/__tests__/env-converter.test.ts +0 -372
- package/core/config/__tests__/env-processor.test.ts +0 -431
- package/core/config/__tests__/env.test.ts +0 -452
- package/core/config/__tests__/integration.test.ts +0 -418
- package/core/config/__tests__/loader.test.ts +0 -331
- package/core/config/__tests__/schema.test.ts +0 -129
- package/core/config/__tests__/validator.test.ts +0 -318
- package/core/framework/__tests__/server.test.ts +0 -233
- package/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
- package/core/plugins/__tests__/manager.test.ts +0 -398
- package/core/plugins/__tests__/monitoring.test.ts +0 -401
- package/core/plugins/__tests__/registry.test.ts +0 -335
- package/core/utils/__tests__/errors.test.ts +0 -139
- package/core/utils/__tests__/helpers.test.ts +0 -297
- package/core/utils/__tests__/logger.test.ts +0 -141
- package/create-test-app.ts +0 -156
- package/docker-compose.microservices.yml +0 -75
- package/docker-compose.simple.yml +0 -57
- package/docker-compose.yml +0 -71
- package/eslint.config.js +0 -23
- package/flux-cli.ts +0 -214
- package/nginx-lb.conf +0 -37
- package/publish.sh +0 -63
- package/run-clean.ts +0 -26
- package/run-env-tests.ts +0 -313
- package/tailwind.config.js +0 -34
- package/tests/__mocks__/api.ts +0 -56
- package/tests/fixtures/users.ts +0 -69
- package/tests/integration/api/users.routes.test.ts +0 -221
- package/tests/setup.ts +0 -29
- package/tests/unit/app/client/App-simple.test.tsx +0 -56
- package/tests/unit/app/client/App.test.tsx.skip +0 -237
- package/tests/unit/app/client/eden-api.test.ts +0 -186
- package/tests/unit/app/client/simple.test.tsx +0 -23
- package/tests/unit/app/controllers/users.controller.test.ts +0 -150
- package/tests/unit/core/create-project.test.ts.skip +0 -95
- package/tests/unit/core/framework.test.ts +0 -144
- package/tests/unit/core/plugins/logger.test.ts.skip +0 -268
- package/tests/unit/core/plugins/vite.test.ts.disabled +0 -188
- package/tests/utils/test-helpers.ts +0 -61
- package/vitest.config.ts +0 -50
- package/workspace.json +0 -6
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for Built-in Plugins
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { describe, it, expect, beforeEach, vi } from 'vitest'
|
|
6
|
-
import {
|
|
7
|
-
loggerPlugin,
|
|
8
|
-
swaggerPlugin,
|
|
9
|
-
vitePlugin,
|
|
10
|
-
staticPlugin,
|
|
11
|
-
monitoringPlugin,
|
|
12
|
-
builtInPlugins,
|
|
13
|
-
builtInPluginsList,
|
|
14
|
-
getDefaultPlugins,
|
|
15
|
-
getBuiltInPlugin,
|
|
16
|
-
isBuiltInPlugin
|
|
17
|
-
} from '../built-in'
|
|
18
|
-
import type { PluginContext, RequestContext, ResponseContext, ErrorContext } from '../types'
|
|
19
|
-
import type { Logger } from '../../utils/logger/index'
|
|
20
|
-
import type { FluxStackConfig } from '../../config/schema'
|
|
21
|
-
|
|
22
|
-
// Mock logger
|
|
23
|
-
const mockLogger: Logger = {
|
|
24
|
-
debug: vi.fn(),
|
|
25
|
-
info: vi.fn(),
|
|
26
|
-
warn: vi.fn(),
|
|
27
|
-
error: vi.fn(),
|
|
28
|
-
child: vi.fn(() => mockLogger),
|
|
29
|
-
time: vi.fn(),
|
|
30
|
-
timeEnd: vi.fn(),
|
|
31
|
-
request: vi.fn()
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Mock app
|
|
35
|
-
const mockApp = {
|
|
36
|
-
use: vi.fn(),
|
|
37
|
-
get: vi.fn(),
|
|
38
|
-
post: vi.fn(),
|
|
39
|
-
put: vi.fn(),
|
|
40
|
-
delete: vi.fn()
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Mock config
|
|
44
|
-
const mockConfig: FluxStackConfig = {
|
|
45
|
-
app: { name: 'test-app', version: '1.0.0' },
|
|
46
|
-
server: {
|
|
47
|
-
port: 3000,
|
|
48
|
-
host: 'localhost',
|
|
49
|
-
apiPrefix: '/api',
|
|
50
|
-
cors: {
|
|
51
|
-
origins: ['*'],
|
|
52
|
-
methods: ['GET', 'POST'],
|
|
53
|
-
headers: ['Content-Type']
|
|
54
|
-
},
|
|
55
|
-
middleware: []
|
|
56
|
-
},
|
|
57
|
-
client: {
|
|
58
|
-
port: 5173,
|
|
59
|
-
proxy: { target: 'http://localhost:3000' },
|
|
60
|
-
build: {
|
|
61
|
-
sourceMaps: true,
|
|
62
|
-
minify: false,
|
|
63
|
-
target: 'esnext',
|
|
64
|
-
outDir: 'dist/client'
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
build: {
|
|
68
|
-
target: 'bun',
|
|
69
|
-
outDir: 'dist',
|
|
70
|
-
optimization: {
|
|
71
|
-
minify: false,
|
|
72
|
-
treeshake: false,
|
|
73
|
-
compress: false,
|
|
74
|
-
splitChunks: false,
|
|
75
|
-
bundleAnalyzer: false
|
|
76
|
-
},
|
|
77
|
-
sourceMaps: true,
|
|
78
|
-
clean: true
|
|
79
|
-
},
|
|
80
|
-
plugins: {
|
|
81
|
-
enabled: [],
|
|
82
|
-
disabled: [],
|
|
83
|
-
config: {}
|
|
84
|
-
},
|
|
85
|
-
logging: {
|
|
86
|
-
level: 'info',
|
|
87
|
-
format: 'pretty',
|
|
88
|
-
transports: []
|
|
89
|
-
},
|
|
90
|
-
monitoring: {
|
|
91
|
-
enabled: false,
|
|
92
|
-
metrics: {
|
|
93
|
-
enabled: false,
|
|
94
|
-
collectInterval: 5000,
|
|
95
|
-
httpMetrics: false,
|
|
96
|
-
systemMetrics: false,
|
|
97
|
-
customMetrics: false
|
|
98
|
-
},
|
|
99
|
-
profiling: {
|
|
100
|
-
enabled: false,
|
|
101
|
-
sampleRate: 0.1,
|
|
102
|
-
memoryProfiling: false,
|
|
103
|
-
cpuProfiling: false
|
|
104
|
-
},
|
|
105
|
-
exporters: []
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Mock utils
|
|
110
|
-
const mockUtils = {
|
|
111
|
-
createTimer: vi.fn(() => ({ end: vi.fn(() => 100) })),
|
|
112
|
-
formatBytes: vi.fn((bytes: number) => `${bytes} bytes`),
|
|
113
|
-
isProduction: vi.fn(() => false),
|
|
114
|
-
isDevelopment: vi.fn(() => true),
|
|
115
|
-
getEnvironment: vi.fn(() => 'development'),
|
|
116
|
-
createHash: vi.fn(() => 'hash123'),
|
|
117
|
-
deepMerge: vi.fn((a, b) => ({ ...a, ...b })),
|
|
118
|
-
validateSchema: vi.fn(() => ({ valid: true, errors: [] }))
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
describe.skip('Built-in Plugins', () => {
|
|
122
|
-
let context: PluginContext
|
|
123
|
-
|
|
124
|
-
beforeEach(() => {
|
|
125
|
-
context = {
|
|
126
|
-
config: mockConfig,
|
|
127
|
-
logger: mockLogger,
|
|
128
|
-
app: mockApp,
|
|
129
|
-
utils: mockUtils
|
|
130
|
-
}
|
|
131
|
-
vi.clearAllMocks()
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
describe('Plugin Structure', () => {
|
|
135
|
-
it('should export all built-in plugins', () => {
|
|
136
|
-
expect(builtInPlugins).toBeDefined()
|
|
137
|
-
expect(builtInPlugins.logger).toBe(loggerPlugin)
|
|
138
|
-
expect(builtInPlugins.swagger).toBe(swaggerPlugin)
|
|
139
|
-
expect(builtInPlugins.vite).toBe(vitePlugin)
|
|
140
|
-
expect(builtInPlugins.static).toBe(staticPlugin)
|
|
141
|
-
expect(builtInPlugins.monitoring).toBe(monitoringPlugin)
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
it('should export plugins as array', () => {
|
|
145
|
-
expect(builtInPluginsList).toHaveLength(5)
|
|
146
|
-
expect(builtInPluginsList).toContain(loggerPlugin)
|
|
147
|
-
expect(builtInPluginsList).toContain(swaggerPlugin)
|
|
148
|
-
expect(builtInPluginsList).toContain(vitePlugin)
|
|
149
|
-
expect(builtInPluginsList).toContain(staticPlugin)
|
|
150
|
-
expect(builtInPluginsList).toContain(monitoringPlugin)
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
it('should have valid plugin structure', () => {
|
|
154
|
-
for (const plugin of builtInPluginsList) {
|
|
155
|
-
expect(plugin.name).toBeDefined()
|
|
156
|
-
expect(typeof plugin.name).toBe('string')
|
|
157
|
-
expect(plugin.version).toBeDefined()
|
|
158
|
-
expect(plugin.description).toBeDefined()
|
|
159
|
-
expect(plugin.author).toBeDefined()
|
|
160
|
-
expect(plugin.setup).toBeDefined()
|
|
161
|
-
expect(typeof plugin.setup).toBe('function')
|
|
162
|
-
}
|
|
163
|
-
})
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
describe('Logger Plugin', () => {
|
|
167
|
-
it('should have correct metadata', () => {
|
|
168
|
-
expect(loggerPlugin.name).toBe('logger')
|
|
169
|
-
expect(loggerPlugin.priority).toBe('highest')
|
|
170
|
-
expect(loggerPlugin.category).toBe('core')
|
|
171
|
-
expect(loggerPlugin.configSchema).toBeDefined()
|
|
172
|
-
expect(loggerPlugin.defaultConfig).toBeDefined()
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
it('should setup successfully', async () => {
|
|
176
|
-
await loggerPlugin.setup!(context)
|
|
177
|
-
expect(mockLogger.info).toHaveBeenCalledWith(
|
|
178
|
-
'Enhanced logger plugin initialized',
|
|
179
|
-
expect.any(Object)
|
|
180
|
-
)
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
it('should handle server start', async () => {
|
|
184
|
-
await loggerPlugin.onServerStart!(context)
|
|
185
|
-
expect(mockLogger.info).toHaveBeenCalledWith(
|
|
186
|
-
'Logger plugin: Server started',
|
|
187
|
-
expect.any(Object)
|
|
188
|
-
)
|
|
189
|
-
})
|
|
190
|
-
|
|
191
|
-
it('should handle server stop', async () => {
|
|
192
|
-
await loggerPlugin.onServerStop!(context)
|
|
193
|
-
expect(mockLogger.info).toHaveBeenCalledWith('Logger plugin: Server stopped')
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
it('should handle request logging', async () => {
|
|
197
|
-
const requestContext: RequestContext = {
|
|
198
|
-
request: new Request('http://localhost:3000/test'),
|
|
199
|
-
path: '/test',
|
|
200
|
-
method: 'GET',
|
|
201
|
-
headers: { 'user-agent': 'test' },
|
|
202
|
-
query: {},
|
|
203
|
-
params: {},
|
|
204
|
-
startTime: Date.now()
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
await loggerPlugin.onRequest!(requestContext)
|
|
208
|
-
// Logger function would be called if available in context
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
it('should handle response logging', async () => {
|
|
212
|
-
const responseContext: ResponseContext = {
|
|
213
|
-
request: new Request('http://localhost:3000/test'),
|
|
214
|
-
path: '/test',
|
|
215
|
-
method: 'GET',
|
|
216
|
-
headers: {},
|
|
217
|
-
query: {},
|
|
218
|
-
params: {},
|
|
219
|
-
startTime: Date.now(),
|
|
220
|
-
response: new Response('OK'),
|
|
221
|
-
statusCode: 200,
|
|
222
|
-
duration: 100
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
await loggerPlugin.onResponse!(responseContext)
|
|
226
|
-
// Logger function would be called if available in context
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
it('should handle error logging', async () => {
|
|
230
|
-
const errorContext: ErrorContext = {
|
|
231
|
-
request: new Request('http://localhost:3000/test'),
|
|
232
|
-
path: '/test',
|
|
233
|
-
method: 'GET',
|
|
234
|
-
headers: {},
|
|
235
|
-
query: {},
|
|
236
|
-
params: {},
|
|
237
|
-
startTime: Date.now(),
|
|
238
|
-
error: new Error('Test error'),
|
|
239
|
-
duration: 100,
|
|
240
|
-
handled: false
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
await loggerPlugin.onError!(errorContext)
|
|
244
|
-
// Logger function would be called if available in context
|
|
245
|
-
})
|
|
246
|
-
})
|
|
247
|
-
|
|
248
|
-
describe('Swagger Plugin', () => {
|
|
249
|
-
it('should have correct metadata', () => {
|
|
250
|
-
expect(swaggerPlugin.name).toBe('swagger')
|
|
251
|
-
expect(swaggerPlugin.priority).toBe('normal')
|
|
252
|
-
expect(swaggerPlugin.category).toBe('documentation')
|
|
253
|
-
expect(swaggerPlugin.configSchema).toBeDefined()
|
|
254
|
-
expect(swaggerPlugin.defaultConfig).toBeDefined()
|
|
255
|
-
})
|
|
256
|
-
|
|
257
|
-
it('should setup successfully', async () => {
|
|
258
|
-
await swaggerPlugin.setup!(context)
|
|
259
|
-
expect(mockApp.use).toHaveBeenCalled()
|
|
260
|
-
expect(mockLogger.info).toHaveBeenCalledWith(
|
|
261
|
-
expect.stringContaining('Swagger documentation enabled'),
|
|
262
|
-
expect.any(Object)
|
|
263
|
-
)
|
|
264
|
-
})
|
|
265
|
-
|
|
266
|
-
it('should handle server start', async () => {
|
|
267
|
-
await swaggerPlugin.onServerStart!(context)
|
|
268
|
-
expect(mockLogger.info).toHaveBeenCalledWith(
|
|
269
|
-
expect.stringContaining('Swagger documentation available')
|
|
270
|
-
)
|
|
271
|
-
})
|
|
272
|
-
})
|
|
273
|
-
|
|
274
|
-
describe('Vite Plugin', () => {
|
|
275
|
-
it('should have correct metadata', () => {
|
|
276
|
-
expect(vitePlugin.name).toBe('vite')
|
|
277
|
-
expect(vitePlugin.priority).toBe('high')
|
|
278
|
-
expect(vitePlugin.category).toBe('development')
|
|
279
|
-
expect(vitePlugin.configSchema).toBeDefined()
|
|
280
|
-
expect(vitePlugin.defaultConfig).toBeDefined()
|
|
281
|
-
})
|
|
282
|
-
|
|
283
|
-
it('should setup successfully', async () => {
|
|
284
|
-
await vitePlugin.setup!(context)
|
|
285
|
-
expect(mockLogger.info).toHaveBeenCalledWith(
|
|
286
|
-
expect.stringContaining('Setting up Vite integration')
|
|
287
|
-
)
|
|
288
|
-
})
|
|
289
|
-
|
|
290
|
-
it('should handle server start', async () => {
|
|
291
|
-
// Setup first to initialize vite config
|
|
292
|
-
await vitePlugin.setup!(context)
|
|
293
|
-
await vitePlugin.onServerStart!(context)
|
|
294
|
-
expect(mockLogger.info).toHaveBeenCalledWith(
|
|
295
|
-
expect.stringContaining('Vite integration active')
|
|
296
|
-
)
|
|
297
|
-
})
|
|
298
|
-
})
|
|
299
|
-
|
|
300
|
-
describe('Static Plugin', () => {
|
|
301
|
-
it('should have correct metadata', () => {
|
|
302
|
-
expect(staticPlugin.name).toBe('static')
|
|
303
|
-
expect(staticPlugin.priority).toBe('low')
|
|
304
|
-
expect(staticPlugin.category).toBe('core')
|
|
305
|
-
expect(staticPlugin.configSchema).toBeDefined()
|
|
306
|
-
expect(staticPlugin.defaultConfig).toBeDefined()
|
|
307
|
-
})
|
|
308
|
-
|
|
309
|
-
it('should setup successfully', async () => {
|
|
310
|
-
await staticPlugin.setup!(context)
|
|
311
|
-
expect(mockApp.get).toHaveBeenCalledWith('/*', expect.any(Function))
|
|
312
|
-
expect(mockLogger.info).toHaveBeenCalledWith(
|
|
313
|
-
'Enhanced static files plugin activated',
|
|
314
|
-
expect.any(Object)
|
|
315
|
-
)
|
|
316
|
-
})
|
|
317
|
-
|
|
318
|
-
it('should handle server start', async () => {
|
|
319
|
-
await staticPlugin.onServerStart!(context)
|
|
320
|
-
expect(mockLogger.info).toHaveBeenCalledWith(
|
|
321
|
-
expect.stringContaining('Static files plugin ready'),
|
|
322
|
-
expect.any(Object)
|
|
323
|
-
)
|
|
324
|
-
})
|
|
325
|
-
})
|
|
326
|
-
|
|
327
|
-
describe('Plugin Utilities', () => {
|
|
328
|
-
it('should get default plugins for development', () => {
|
|
329
|
-
const plugins = getDefaultPlugins('development')
|
|
330
|
-
expect(plugins).toHaveLength(5)
|
|
331
|
-
expect(plugins).toContain(loggerPlugin)
|
|
332
|
-
expect(plugins).toContain(staticPlugin)
|
|
333
|
-
expect(plugins).toContain(vitePlugin)
|
|
334
|
-
expect(plugins).toContain(swaggerPlugin)
|
|
335
|
-
expect(plugins).toContain(monitoringPlugin)
|
|
336
|
-
})
|
|
337
|
-
|
|
338
|
-
it('should get default plugins for production', () => {
|
|
339
|
-
const plugins = getDefaultPlugins('production')
|
|
340
|
-
expect(plugins).toHaveLength(3)
|
|
341
|
-
expect(plugins).toContain(loggerPlugin)
|
|
342
|
-
expect(plugins).toContain(staticPlugin)
|
|
343
|
-
expect(plugins).toContain(monitoringPlugin)
|
|
344
|
-
})
|
|
345
|
-
|
|
346
|
-
it('should get default plugins for test', () => {
|
|
347
|
-
const plugins = getDefaultPlugins('test')
|
|
348
|
-
expect(plugins).toHaveLength(1)
|
|
349
|
-
expect(plugins).toContain(loggerPlugin)
|
|
350
|
-
})
|
|
351
|
-
|
|
352
|
-
it('should get plugin by name', () => {
|
|
353
|
-
expect(getBuiltInPlugin('logger')).toBe(loggerPlugin)
|
|
354
|
-
expect(getBuiltInPlugin('swagger')).toBe(swaggerPlugin)
|
|
355
|
-
expect(getBuiltInPlugin('monitoring')).toBe(monitoringPlugin)
|
|
356
|
-
expect(getBuiltInPlugin('nonexistent')).toBeUndefined()
|
|
357
|
-
})
|
|
358
|
-
|
|
359
|
-
it('should check if plugin is built-in', () => {
|
|
360
|
-
expect(isBuiltInPlugin('logger')).toBe(true)
|
|
361
|
-
expect(isBuiltInPlugin('swagger')).toBe(true)
|
|
362
|
-
expect(isBuiltInPlugin('monitoring')).toBe(true)
|
|
363
|
-
expect(isBuiltInPlugin('custom-plugin')).toBe(false)
|
|
364
|
-
})
|
|
365
|
-
})
|
|
366
|
-
})
|