@oalacea/daemon 0.5.0 → 0.6.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.
Files changed (222) hide show
  1. package/LICENSE +23 -23
  2. package/README.md +147 -141
  3. package/bin/Dockerfile +75 -74
  4. package/dist/cli/cli.d.ts +42 -0
  5. package/dist/cli/cli.d.ts.map +1 -0
  6. package/dist/cli/cli.js +89 -0
  7. package/dist/cli/cli.js.map +1 -0
  8. package/dist/cli/commands/detect.command.d.ts +39 -0
  9. package/dist/cli/commands/detect.command.d.ts.map +1 -0
  10. package/dist/cli/commands/detect.command.js +111 -0
  11. package/dist/cli/commands/detect.command.js.map +1 -0
  12. package/dist/cli/commands/index.d.ts +14 -0
  13. package/dist/cli/commands/index.d.ts.map +1 -0
  14. package/dist/cli/commands/index.js +11 -0
  15. package/dist/cli/commands/index.js.map +1 -0
  16. package/dist/cli/commands/init.command.d.ts +41 -0
  17. package/dist/cli/commands/init.command.d.ts.map +1 -0
  18. package/dist/cli/commands/init.command.js +111 -0
  19. package/dist/cli/commands/init.command.js.map +1 -0
  20. package/dist/cli/commands/test.command.d.ts +58 -0
  21. package/dist/cli/commands/test.command.d.ts.map +1 -0
  22. package/dist/cli/commands/test.command.js +180 -0
  23. package/dist/cli/commands/test.command.js.map +1 -0
  24. package/dist/cli/index.d.ts +8 -0
  25. package/dist/cli/index.d.ts.map +1 -0
  26. package/dist/cli/index.js +10 -0
  27. package/dist/cli/index.js.map +1 -0
  28. package/dist/core/config/daemon.config.d.ts +32 -0
  29. package/dist/core/config/daemon.config.d.ts.map +1 -0
  30. package/dist/core/config/daemon.config.js +83 -0
  31. package/dist/core/config/daemon.config.js.map +1 -0
  32. package/dist/core/config/index.d.ts +5 -0
  33. package/dist/core/config/index.d.ts.map +1 -0
  34. package/dist/core/config/index.js +5 -0
  35. package/dist/core/config/index.js.map +1 -0
  36. package/dist/core/constants.d.ts +36 -0
  37. package/dist/core/constants.d.ts.map +1 -0
  38. package/dist/core/constants.js +56 -0
  39. package/dist/core/constants.js.map +1 -0
  40. package/dist/core/types/common.types.d.ts +250 -0
  41. package/dist/core/types/common.types.d.ts.map +1 -0
  42. package/dist/core/types/common.types.js +7 -0
  43. package/dist/core/types/common.types.js.map +1 -0
  44. package/dist/core/types/detection.types.d.ts +232 -0
  45. package/dist/core/types/detection.types.d.ts.map +1 -0
  46. package/dist/core/types/detection.types.js +22 -0
  47. package/dist/core/types/detection.types.js.map +1 -0
  48. package/dist/core/types/docker.types.d.ts +322 -0
  49. package/dist/core/types/docker.types.d.ts.map +1 -0
  50. package/dist/core/types/docker.types.js +7 -0
  51. package/dist/core/types/docker.types.js.map +1 -0
  52. package/dist/core/types/index.d.ts +11 -0
  53. package/dist/core/types/index.d.ts.map +1 -0
  54. package/dist/core/types/index.js +7 -0
  55. package/dist/core/types/index.js.map +1 -0
  56. package/dist/core/types/project.types.d.ts +74 -0
  57. package/dist/core/types/project.types.d.ts.map +1 -0
  58. package/dist/core/types/project.types.js +7 -0
  59. package/dist/core/types/project.types.js.map +1 -0
  60. package/dist/core/types/shared.types.d.ts +118 -0
  61. package/dist/core/types/shared.types.d.ts.map +1 -0
  62. package/dist/core/types/shared.types.js +7 -0
  63. package/dist/core/types/shared.types.js.map +1 -0
  64. package/dist/core/types/test.types.d.ts +230 -0
  65. package/dist/core/types/test.types.d.ts.map +1 -0
  66. package/dist/core/types/test.types.js +7 -0
  67. package/dist/core/types/test.types.js.map +1 -0
  68. package/dist/services/detection/__tests__/framework-detector.test.d.ts +5 -0
  69. package/dist/services/detection/__tests__/framework-detector.test.d.ts.map +1 -0
  70. package/dist/services/detection/__tests__/framework-detector.test.js +52 -0
  71. package/dist/services/detection/__tests__/framework-detector.test.js.map +1 -0
  72. package/dist/services/detection/framework-detector.d.ts +179 -0
  73. package/dist/services/detection/framework-detector.d.ts.map +1 -0
  74. package/dist/services/detection/framework-detector.js +636 -0
  75. package/dist/services/detection/framework-detector.js.map +1 -0
  76. package/dist/services/detection/index.d.ts +10 -0
  77. package/dist/services/detection/index.d.ts.map +1 -0
  78. package/dist/services/detection/index.js +7 -0
  79. package/dist/services/detection/index.js.map +1 -0
  80. package/dist/services/docker/__tests__/docker-manager.test.d.ts +5 -0
  81. package/dist/services/docker/__tests__/docker-manager.test.d.ts.map +1 -0
  82. package/dist/services/docker/__tests__/docker-manager.test.js +67 -0
  83. package/dist/services/docker/__tests__/docker-manager.test.js.map +1 -0
  84. package/dist/services/docker/docker-manager.d.ts +157 -0
  85. package/dist/services/docker/docker-manager.d.ts.map +1 -0
  86. package/dist/services/docker/docker-manager.js +516 -0
  87. package/dist/services/docker/docker-manager.js.map +1 -0
  88. package/dist/services/docker/index.d.ts +9 -0
  89. package/dist/services/docker/index.d.ts.map +1 -0
  90. package/dist/services/docker/index.js +9 -0
  91. package/dist/services/docker/index.js.map +1 -0
  92. package/dist/services/index.d.ts +10 -0
  93. package/dist/services/index.d.ts.map +1 -0
  94. package/dist/services/index.js +8 -0
  95. package/dist/services/index.js.map +1 -0
  96. package/dist/shared/errors/__tests__/base.error.test.d.ts +5 -0
  97. package/dist/shared/errors/__tests__/base.error.test.d.ts.map +1 -0
  98. package/dist/shared/errors/__tests__/base.error.test.js +61 -0
  99. package/dist/shared/errors/__tests__/base.error.test.js.map +1 -0
  100. package/dist/shared/errors/__tests__/command.error.test.d.ts +5 -0
  101. package/dist/shared/errors/__tests__/command.error.test.d.ts.map +1 -0
  102. package/dist/shared/errors/__tests__/command.error.test.js +62 -0
  103. package/dist/shared/errors/__tests__/command.error.test.js.map +1 -0
  104. package/dist/shared/errors/__tests__/file.error.test.d.ts +5 -0
  105. package/dist/shared/errors/__tests__/file.error.test.d.ts.map +1 -0
  106. package/dist/shared/errors/__tests__/file.error.test.js +75 -0
  107. package/dist/shared/errors/__tests__/file.error.test.js.map +1 -0
  108. package/dist/shared/errors/__tests__/index.test.d.ts +5 -0
  109. package/dist/shared/errors/__tests__/index.test.d.ts.map +1 -0
  110. package/dist/shared/errors/__tests__/index.test.js +62 -0
  111. package/dist/shared/errors/__tests__/index.test.js.map +1 -0
  112. package/dist/shared/errors/__tests__/validation.error.test.d.ts +5 -0
  113. package/dist/shared/errors/__tests__/validation.error.test.d.ts.map +1 -0
  114. package/dist/shared/errors/__tests__/validation.error.test.js +79 -0
  115. package/dist/shared/errors/__tests__/validation.error.test.js.map +1 -0
  116. package/dist/shared/errors/base.error.d.ts +54 -0
  117. package/dist/shared/errors/base.error.d.ts.map +1 -0
  118. package/dist/shared/errors/base.error.js +85 -0
  119. package/dist/shared/errors/base.error.js.map +1 -0
  120. package/dist/shared/errors/command.error.d.ts +58 -0
  121. package/dist/shared/errors/command.error.d.ts.map +1 -0
  122. package/dist/shared/errors/command.error.js +102 -0
  123. package/dist/shared/errors/command.error.js.map +1 -0
  124. package/dist/shared/errors/detection.error.d.ts +42 -0
  125. package/dist/shared/errors/detection.error.d.ts.map +1 -0
  126. package/dist/shared/errors/detection.error.js +82 -0
  127. package/dist/shared/errors/detection.error.js.map +1 -0
  128. package/dist/shared/errors/docker.error.d.ts +142 -0
  129. package/dist/shared/errors/docker.error.d.ts.map +1 -0
  130. package/dist/shared/errors/docker.error.js +172 -0
  131. package/dist/shared/errors/docker.error.js.map +1 -0
  132. package/dist/shared/errors/file.error.d.ts +66 -0
  133. package/dist/shared/errors/file.error.d.ts.map +1 -0
  134. package/dist/shared/errors/file.error.js +93 -0
  135. package/dist/shared/errors/file.error.js.map +1 -0
  136. package/dist/shared/errors/index.d.ts +56 -0
  137. package/dist/shared/errors/index.d.ts.map +1 -0
  138. package/dist/shared/errors/index.js +86 -0
  139. package/dist/shared/errors/index.js.map +1 -0
  140. package/dist/shared/errors/validation.error.d.ts +67 -0
  141. package/dist/shared/errors/validation.error.d.ts.map +1 -0
  142. package/dist/shared/errors/validation.error.js +97 -0
  143. package/dist/shared/errors/validation.error.js.map +1 -0
  144. package/dist/shared/templates/index.d.ts +2 -0
  145. package/dist/shared/templates/index.d.ts.map +1 -0
  146. package/dist/shared/templates/index.js +2 -0
  147. package/dist/shared/templates/index.js.map +1 -0
  148. package/dist/shared/templates/prompt-builder.d.ts +2 -0
  149. package/dist/shared/templates/prompt-builder.d.ts.map +1 -0
  150. package/dist/shared/templates/prompt-builder.js +2 -0
  151. package/dist/shared/templates/prompt-builder.js.map +1 -0
  152. package/dist/shared/templates/template-engine.d.ts +2 -0
  153. package/dist/shared/templates/template-engine.d.ts.map +1 -0
  154. package/dist/shared/templates/template-engine.js +2 -0
  155. package/dist/shared/templates/template-engine.js.map +1 -0
  156. package/dist/shared/utils/__tests__/command-executor.test.d.ts +5 -0
  157. package/dist/shared/utils/__tests__/command-executor.test.d.ts.map +1 -0
  158. package/dist/shared/utils/__tests__/command-executor.test.js +45 -0
  159. package/dist/shared/utils/__tests__/command-executor.test.js.map +1 -0
  160. package/dist/shared/utils/__tests__/file-helper.test.d.ts +5 -0
  161. package/dist/shared/utils/__tests__/file-helper.test.d.ts.map +1 -0
  162. package/dist/shared/utils/__tests__/file-helper.test.js +71 -0
  163. package/dist/shared/utils/__tests__/file-helper.test.js.map +1 -0
  164. package/dist/shared/utils/__tests__/logger.test.d.ts +5 -0
  165. package/dist/shared/utils/__tests__/logger.test.d.ts.map +1 -0
  166. package/dist/shared/utils/__tests__/logger.test.js +83 -0
  167. package/dist/shared/utils/__tests__/logger.test.js.map +1 -0
  168. package/dist/shared/utils/command-executer.d.ts +2 -0
  169. package/dist/shared/utils/command-executer.d.ts.map +1 -0
  170. package/dist/shared/utils/command-executer.js +2 -0
  171. package/dist/shared/utils/command-executer.js.map +1 -0
  172. package/dist/shared/utils/command-executor.d.ts +255 -0
  173. package/dist/shared/utils/command-executor.d.ts.map +1 -0
  174. package/dist/shared/utils/command-executor.js +287 -0
  175. package/dist/shared/utils/command-executor.js.map +1 -0
  176. package/dist/shared/utils/file-helper.d.ts +86 -0
  177. package/dist/shared/utils/file-helper.d.ts.map +1 -0
  178. package/dist/shared/utils/file-helper.js +323 -0
  179. package/dist/shared/utils/file-helper.js.map +1 -0
  180. package/dist/shared/utils/index.d.ts +9 -0
  181. package/dist/shared/utils/index.d.ts.map +1 -0
  182. package/dist/shared/utils/index.js +9 -0
  183. package/dist/shared/utils/index.js.map +1 -0
  184. package/dist/shared/utils/logger.d.ts +163 -0
  185. package/dist/shared/utils/logger.d.ts.map +1 -0
  186. package/dist/shared/utils/logger.js +389 -0
  187. package/dist/shared/utils/logger.js.map +1 -0
  188. package/package.json +53 -34
  189. package/prompts/DEPS_EFFICIENCY.md +558 -558
  190. package/prompts/E2E.md +491 -491
  191. package/prompts/EXECUTE.md +1060 -1060
  192. package/prompts/INTEGRATION_API.md +484 -484
  193. package/prompts/INTEGRATION_DB.md +425 -425
  194. package/prompts/PERF_API.md +433 -433
  195. package/prompts/PERF_DB.md +430 -430
  196. package/prompts/PERF_FRONT.md +357 -357
  197. package/prompts/REMEDIATION.md +482 -482
  198. package/prompts/UNIT.md +260 -260
  199. package/templates/README.md +38 -38
  200. package/templates/k6/load-test.js +54 -54
  201. package/templates/playwright/e2e.spec.ts +61 -61
  202. package/templates/vitest/angular-component.test.ts +38 -38
  203. package/templates/vitest/api.test.ts +51 -51
  204. package/templates/vitest/component.test.ts +27 -27
  205. package/templates/vitest/hook.test.ts +36 -36
  206. package/templates/vitest/solid-component.test.ts +34 -34
  207. package/templates/vitest/svelte-component.test.ts +33 -33
  208. package/templates/vitest/vue-component.test.ts +39 -39
  209. package/CHANGELOG.md +0 -38
  210. package/agents/deps-analyzer.js +0 -366
  211. package/agents/detector.js +0 -570
  212. package/agents/fix-engine.js +0 -305
  213. package/agents/lighthouse-scanner.js +0 -405
  214. package/agents/perf-analyzer.js +0 -294
  215. package/agents/perf-front-analyzer.js +0 -229
  216. package/agents/test-generator.js +0 -387
  217. package/agents/test-runner.js +0 -318
  218. package/bin/cli.js +0 -449
  219. package/lib/config.js +0 -250
  220. package/lib/docker.js +0 -207
  221. package/lib/reporter.js +0 -297
  222. package/scripts/dev.js +0 -106
@@ -1,54 +1,54 @@
1
- import http from 'k6/http';
2
- import { check, sleep } from 'k6';
3
-
4
- // Configuration
5
- export const options = {
6
- stages: [
7
- { duration: '30s', target: 20 }, // Ramp up to 20 users
8
- { duration: '1m', target: 20 }, // Stay at 20 users
9
- { duration: '30s', target: 50 }, // Ramp up to 50 users
10
- { duration: '1m', target: 50 }, // Stay at 50 users
11
- { duration: '30s', target: 0 }, // Ramp down
12
- ],
13
- thresholds: {
14
- http_req_duration: ['p(95)<200', 'p(99)<500'],
15
- http_req_failed: ['rate<0.01'],
16
- },
17
- };
18
-
19
- const BASE_URL = __ENV.BASE_URL || 'http://host.docker.internal:3000';
20
-
21
- export default function () {
22
- // Test homepage
23
- let res = http.get(`${BASE_URL}/`);
24
- check(res, {
25
- 'homepage status 200': (r) => r.status === 200,
26
- 'homepage response time < 200ms': (r) => r.timings.duration < 200,
27
- });
28
-
29
- sleep(1);
30
-
31
- // Test API endpoint
32
- res = http.get(`${BASE_URL}/api/users`);
33
- check(res, {
34
- 'users API status 200': (r) => r.status === 200,
35
- 'users response time < 200ms': (r) => r.timings.duration < 200,
36
- });
37
-
38
- sleep(1);
39
-
40
- // Test POST endpoint
41
- res = http.post(`${BASE_URL}/api/contact`, JSON.stringify({
42
- name: 'Test User',
43
- email: 'test@example.com',
44
- message: 'Test message',
45
- }), {
46
- headers: { 'Content-Type': 'application/json' },
47
- });
48
-
49
- check(res, {
50
- 'contact API status 200': (r) => r.status === 200,
51
- });
52
-
53
- sleep(1);
54
- }
1
+ import http from 'k6/http';
2
+ import { check, sleep } from 'k6';
3
+
4
+ // Configuration
5
+ export const options = {
6
+ stages: [
7
+ { duration: '30s', target: 20 }, // Ramp up to 20 users
8
+ { duration: '1m', target: 20 }, // Stay at 20 users
9
+ { duration: '30s', target: 50 }, // Ramp up to 50 users
10
+ { duration: '1m', target: 50 }, // Stay at 50 users
11
+ { duration: '30s', target: 0 }, // Ramp down
12
+ ],
13
+ thresholds: {
14
+ http_req_duration: ['p(95)<200', 'p(99)<500'],
15
+ http_req_failed: ['rate<0.01'],
16
+ },
17
+ };
18
+
19
+ const BASE_URL = __ENV.BASE_URL || 'http://host.docker.internal:3000';
20
+
21
+ export default function () {
22
+ // Test homepage
23
+ let res = http.get(`${BASE_URL}/`);
24
+ check(res, {
25
+ 'homepage status 200': (r) => r.status === 200,
26
+ 'homepage response time < 200ms': (r) => r.timings.duration < 200,
27
+ });
28
+
29
+ sleep(1);
30
+
31
+ // Test API endpoint
32
+ res = http.get(`${BASE_URL}/api/users`);
33
+ check(res, {
34
+ 'users API status 200': (r) => r.status === 200,
35
+ 'users response time < 200ms': (r) => r.timings.duration < 200,
36
+ });
37
+
38
+ sleep(1);
39
+
40
+ // Test POST endpoint
41
+ res = http.post(`${BASE_URL}/api/contact`, JSON.stringify({
42
+ name: 'Test User',
43
+ email: 'test@example.com',
44
+ message: 'Test message',
45
+ }), {
46
+ headers: { 'Content-Type': 'application/json' },
47
+ });
48
+
49
+ check(res, {
50
+ 'contact API status 200': (r) => r.status === 200,
51
+ });
52
+
53
+ sleep(1);
54
+ }
@@ -1,61 +1,61 @@
1
- import { test, expect } from '@playwright/test';
2
-
3
- test.describe('Authentication Flow', () => {
4
- test.beforeEach(async ({ page }) => {
5
- await page.goto('/login');
6
- });
7
-
8
- test('should login with valid credentials', async ({ page }) => {
9
- await page.fill('input[name="email"]', 'test@example.com');
10
- await page.fill('input[name="password"]', 'password123');
11
- await page.click('button[type="submit"]');
12
-
13
- // Should redirect to dashboard
14
- await expect(page).toHaveURL(/\/dashboard/);
15
- await expect(page.locator('h1')).toContainText('Dashboard');
16
- });
17
-
18
- test('should show error with invalid credentials', async ({ page }) => {
19
- await page.fill('input[name="email"]', 'test@example.com');
20
- await page.fill('input[name="password"]', 'wrong-password');
21
- await page.click('button[type="submit"]');
22
-
23
- await expect(page.locator('.error')).toContainText('Invalid credentials');
24
- await expect(page).toHaveURL('/login');
25
- });
26
- });
27
-
28
- test.describe('Navigation', () => {
29
- test('should navigate between pages', async ({ page }) => {
30
- await page.goto('/');
31
-
32
- await page.click('text=About');
33
- await expect(page).toHaveURL('/about');
34
-
35
- await page.goBack();
36
- await expect(page).toHaveURL('/');
37
-
38
- await page.goForward();
39
- await expect(page).toHaveURL('/about');
40
- });
41
- });
42
-
43
- test.describe('Form Interaction', () => {
44
- test('should submit form successfully', async ({ page }) => {
45
- await page.goto('/form');
46
-
47
- await page.fill('input[name="name"]', 'Test User');
48
- await page.fill('input[name="email"]', 'test@example.com');
49
- await page.click('button[type="submit"]');
50
-
51
- await expect(page.locator('.success')).toContainText('Form submitted');
52
- });
53
-
54
- test('should show validation errors', async ({ page }) => {
55
- await page.goto('/form');
56
- await page.click('button[type="submit"]');
57
-
58
- await expect(page.locator('input[name="name"]')).toHaveAttribute('aria-invalid', 'true');
59
- await expect(page.locator('input[name="email"]')).toHaveAttribute('aria-invalid', 'true');
60
- });
61
- });
1
+ import { test, expect } from '@playwright/test';
2
+
3
+ test.describe('Authentication Flow', () => {
4
+ test.beforeEach(async ({ page }) => {
5
+ await page.goto('/login');
6
+ });
7
+
8
+ test('should login with valid credentials', async ({ page }) => {
9
+ await page.fill('input[name="email"]', 'test@example.com');
10
+ await page.fill('input[name="password"]', 'password123');
11
+ await page.click('button[type="submit"]');
12
+
13
+ // Should redirect to dashboard
14
+ await expect(page).toHaveURL(/\/dashboard/);
15
+ await expect(page.locator('h1')).toContainText('Dashboard');
16
+ });
17
+
18
+ test('should show error with invalid credentials', async ({ page }) => {
19
+ await page.fill('input[name="email"]', 'test@example.com');
20
+ await page.fill('input[name="password"]', 'wrong-password');
21
+ await page.click('button[type="submit"]');
22
+
23
+ await expect(page.locator('.error')).toContainText('Invalid credentials');
24
+ await expect(page).toHaveURL('/login');
25
+ });
26
+ });
27
+
28
+ test.describe('Navigation', () => {
29
+ test('should navigate between pages', async ({ page }) => {
30
+ await page.goto('/');
31
+
32
+ await page.click('text=About');
33
+ await expect(page).toHaveURL('/about');
34
+
35
+ await page.goBack();
36
+ await expect(page).toHaveURL('/');
37
+
38
+ await page.goForward();
39
+ await expect(page).toHaveURL('/about');
40
+ });
41
+ });
42
+
43
+ test.describe('Form Interaction', () => {
44
+ test('should submit form successfully', async ({ page }) => {
45
+ await page.goto('/form');
46
+
47
+ await page.fill('input[name="name"]', 'Test User');
48
+ await page.fill('input[name="email"]', 'test@example.com');
49
+ await page.click('button[type="submit"]');
50
+
51
+ await expect(page.locator('.success')).toContainText('Form submitted');
52
+ });
53
+
54
+ test('should show validation errors', async ({ page }) => {
55
+ await page.goto('/form');
56
+ await page.click('button[type="submit"]');
57
+
58
+ await expect(page.locator('input[name="name"]')).toHaveAttribute('aria-invalid', 'true');
59
+ await expect(page.locator('input[name="email"]')).toHaveAttribute('aria-invalid', 'true');
60
+ });
61
+ });
@@ -1,38 +1,38 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { describe, it, expect } from 'vitest';
3
-
4
- // TODO: Import your component
5
- // import { ComponentName } from '@/components/component-name.component';
6
-
7
- describe('ComponentName', () => {
8
- let component: ComponentFixture<any>;
9
-
10
- beforeEach(async () => {
11
- // TODO: Configure TestBed
12
- // await TestBed.configureTestingModule({
13
- // imports: [ComponentName],
14
- // }).compileComponents();
15
-
16
- // component = TestBed.createComponent(ComponentName);
17
- // component.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- // TODO: Test component creation
22
- // expect(component.componentInstance).toBeTruthy();
23
- });
24
-
25
- it('should render title', () => {
26
- // TODO: Test rendered content
27
- // const compiled = component.nativeElement as HTMLElement;
28
- // expect(compiled.querySelector('h1')?.textContent).toContain('Test');
29
- });
30
-
31
- it('should handle user interaction', () => {
32
- // TODO: Test events
33
- // const button = component.nativeElement.querySelector('button');
34
- // button.click();
35
- // component.detectChanges();
36
- // expect(component.instance.value).toBe('updated');
37
- });
38
- });
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { describe, it, expect } from 'vitest';
3
+
4
+ // TODO: Import your component
5
+ // import { ComponentName } from '@/components/component-name.component';
6
+
7
+ describe('ComponentName', () => {
8
+ let component: ComponentFixture<any>;
9
+
10
+ beforeEach(async () => {
11
+ // TODO: Configure TestBed
12
+ // await TestBed.configureTestingModule({
13
+ // imports: [ComponentName],
14
+ // }).compileComponents();
15
+
16
+ // component = TestBed.createComponent(ComponentName);
17
+ // component.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ // TODO: Test component creation
22
+ // expect(component.componentInstance).toBeTruthy();
23
+ });
24
+
25
+ it('should render title', () => {
26
+ // TODO: Test rendered content
27
+ // const compiled = component.nativeElement as HTMLElement;
28
+ // expect(compiled.querySelector('h1')?.textContent).toContain('Test');
29
+ });
30
+
31
+ it('should handle user interaction', () => {
32
+ // TODO: Test events
33
+ // const button = component.nativeElement.querySelector('button');
34
+ // button.click();
35
+ // component.detectChanges();
36
+ // expect(component.instance.value).toBe('updated');
37
+ });
38
+ });
@@ -1,51 +1,51 @@
1
- import { describe, it, expect, beforeEach, afterEach } from 'vitest';
2
- import { POST, GET, PATCH, DELETE } from '@/app/api/route';
3
-
4
- // TODO: Import database setup if needed
5
- // import { db } from '@test/db';
6
-
7
- describe('API Endpoint', () => {
8
- beforeEach(async () => {
9
- // TODO: Setup test database
10
- // await db.begin();
11
- });
12
-
13
- afterEach(async () => {
14
- // TODO: Cleanup test database
15
- // await db.rollback();
16
- });
17
-
18
- it('should return 200 for GET request', async () => {
19
- const request = new Request('http://localhost:3000/api/endpoint', {
20
- method: 'GET',
21
- });
22
-
23
- const response = await GET(request);
24
- expect(response.status).toBe(200);
25
- });
26
-
27
- it('should create resource with POST', async () => {
28
- const request = new Request('http://localhost:3000/api/endpoint', {
29
- method: 'POST',
30
- headers: { 'Content-Type': 'application/json' },
31
- body: JSON.stringify({ name: 'Test' }),
32
- });
33
-
34
- const response = await POST(request);
35
- expect(response.status).toBe(201);
36
-
37
- const data = await response.json();
38
- expect(data).toHaveProperty('id');
39
- });
40
-
41
- it('should validate input data', async () => {
42
- const request = new Request('http://localhost:3000/api/endpoint', {
43
- method: 'POST',
44
- headers: { 'Content-Type': 'application/json' },
45
- body: JSON.stringify({ invalid: 'data' }),
46
- });
47
-
48
- const response = await POST(request);
49
- expect(response.status).toBe(400);
50
- });
51
- });
1
+ import { describe, it, expect, beforeEach, afterEach } from 'vitest';
2
+ import { POST, GET, PATCH, DELETE } from '@/app/api/route';
3
+
4
+ // TODO: Import database setup if needed
5
+ // import { db } from '@test/db';
6
+
7
+ describe('API Endpoint', () => {
8
+ beforeEach(async () => {
9
+ // TODO: Setup test database
10
+ // await db.begin();
11
+ });
12
+
13
+ afterEach(async () => {
14
+ // TODO: Cleanup test database
15
+ // await db.rollback();
16
+ });
17
+
18
+ it('should return 200 for GET request', async () => {
19
+ const request = new Request('http://localhost:3000/api/endpoint', {
20
+ method: 'GET',
21
+ });
22
+
23
+ const response = await GET(request);
24
+ expect(response.status).toBe(200);
25
+ });
26
+
27
+ it('should create resource with POST', async () => {
28
+ const request = new Request('http://localhost:3000/api/endpoint', {
29
+ method: 'POST',
30
+ headers: { 'Content-Type': 'application/json' },
31
+ body: JSON.stringify({ name: 'Test' }),
32
+ });
33
+
34
+ const response = await POST(request);
35
+ expect(response.status).toBe(201);
36
+
37
+ const data = await response.json();
38
+ expect(data).toHaveProperty('id');
39
+ });
40
+
41
+ it('should validate input data', async () => {
42
+ const request = new Request('http://localhost:3000/api/endpoint', {
43
+ method: 'POST',
44
+ headers: { 'Content-Type': 'application/json' },
45
+ body: JSON.stringify({ invalid: 'data' }),
46
+ });
47
+
48
+ const response = await POST(request);
49
+ expect(response.status).toBe(400);
50
+ });
51
+ });
@@ -1,27 +1,27 @@
1
- import { render, screen } from '@testing-library/react';
2
- import { describe, it, expect, vi } from 'vitest';
3
- import userEvent from '@testing-library/user-event';
4
-
5
- // TODO: Import your component
6
- // import { ComponentName } from '@/components/ComponentName';
7
-
8
- describe('ComponentName', () => {
9
- it('should render', () => {
10
- // TODO: Add component render
11
- // render(<ComponentName />);
12
- // expect(screen.getByRole('button')).toBeInTheDocument();
13
- });
14
-
15
- it('should render with children', () => {
16
- // TODO: Test children rendering
17
- // render(<ComponentName>Test content</ComponentName>);
18
- // expect(screen.getByText('Test content')).toBeInTheDocument();
19
- });
20
-
21
- it('should handle user interaction', async () => {
22
- // TODO: Test click/hover/etc
23
- // const user = userEvent.setup();
24
- // render(<ComponentName onClick={vi.fn()} />);
25
- // await user.click(screen.getByRole('button'));
26
- });
27
- });
1
+ import { render, screen } from '@testing-library/react';
2
+ import { describe, it, expect, vi } from 'vitest';
3
+ import userEvent from '@testing-library/user-event';
4
+
5
+ // TODO: Import your component
6
+ // import { ComponentName } from '@/components/ComponentName';
7
+
8
+ describe('ComponentName', () => {
9
+ it('should render', () => {
10
+ // TODO: Add component render
11
+ // render(<ComponentName />);
12
+ // expect(screen.getByRole('button')).toBeInTheDocument();
13
+ });
14
+
15
+ it('should render with children', () => {
16
+ // TODO: Test children rendering
17
+ // render(<ComponentName>Test content</ComponentName>);
18
+ // expect(screen.getByText('Test content')).toBeInTheDocument();
19
+ });
20
+
21
+ it('should handle user interaction', async () => {
22
+ // TODO: Test click/hover/etc
23
+ // const user = userEvent.setup();
24
+ // render(<ComponentName onClick={vi.fn()} />);
25
+ // await user.click(screen.getByRole('button'));
26
+ });
27
+ });
@@ -1,36 +1,36 @@
1
- import { renderHook, act, waitFor } from '@testing-library/react';
2
- import { describe, it, expect, vi, beforeEach } from 'vitest';
3
-
4
- // TODO: Import your hook
5
- // import { useHookName } from '@/hooks/useHookName';
6
-
7
- describe('useHookName', () => {
8
- beforeEach(() => {
9
- vi.clearAllMocks();
10
- });
11
-
12
- it('should return initial state', () => {
13
- // TODO: Test initial state
14
- // const { result } = renderHook(() => useHookName());
15
- // expect(result.current).toBeDefined();
16
- });
17
-
18
- it('should update state', async () => {
19
- // TODO: Test state updates
20
- // const { result } = renderHook(() => useHookName());
21
- // act(() => {
22
- // result.current.setValue('test');
23
- // });
24
- // await waitFor(() => {
25
- // expect(result.current.value).toBe('test');
26
- // });
27
- });
28
-
29
- it('should cleanup on unmount', () => {
30
- // TODO: Test cleanup
31
- // const { unmount } = renderHook(() => useHookName());
32
- // const cleanup = vi.fn();
33
- // unmount();
34
- // expect(cleanup).toHaveBeenCalled();
35
- });
36
- });
1
+ import { renderHook, act, waitFor } from '@testing-library/react';
2
+ import { describe, it, expect, vi, beforeEach } from 'vitest';
3
+
4
+ // TODO: Import your hook
5
+ // import { useHookName } from '@/hooks/useHookName';
6
+
7
+ describe('useHookName', () => {
8
+ beforeEach(() => {
9
+ vi.clearAllMocks();
10
+ });
11
+
12
+ it('should return initial state', () => {
13
+ // TODO: Test initial state
14
+ // const { result } = renderHook(() => useHookName());
15
+ // expect(result.current).toBeDefined();
16
+ });
17
+
18
+ it('should update state', async () => {
19
+ // TODO: Test state updates
20
+ // const { result } = renderHook(() => useHookName());
21
+ // act(() => {
22
+ // result.current.setValue('test');
23
+ // });
24
+ // await waitFor(() => {
25
+ // expect(result.current.value).toBe('test');
26
+ // });
27
+ });
28
+
29
+ it('should cleanup on unmount', () => {
30
+ // TODO: Test cleanup
31
+ // const { unmount } = renderHook(() => useHookName());
32
+ // const cleanup = vi.fn();
33
+ // unmount();
34
+ // expect(cleanup).toHaveBeenCalled();
35
+ });
36
+ });
@@ -1,34 +1,34 @@
1
- import { render, screen } from '@solidjs/testing-library';
2
- import { describe, it, expect, vi } from 'vitest';
3
-
4
- // TODO: Import your component
5
- // import ComponentName from '@/components/ComponentName';
6
-
7
- describe('ComponentName', () => {
8
- it('should render', () => {
9
- // TODO: Add component render
10
- // render(() => <ComponentName />);
11
- // expect(screen.getByRole('button')).toBeInTheDocument();
12
- });
13
-
14
- it('should render with props', () => {
15
- // TODO: Test props
16
- // render(() => <ComponentName title="Test Title" />);
17
- // expect(screen.getByText('Test Title')).toBeInTheDocument();
18
- });
19
-
20
- it('should handle user interaction', async () => {
21
- // TODO: Test events
22
- // const handleClick = vi.fn();
23
- // render(() => <ComponentName onClick={handleClick} />);
24
- // const button = screen.getByRole('button');
25
- // button.click();
26
- // expect(handleClick).toHaveBeenCalledTimes(1);
27
- });
28
-
29
- it('should update with reactive state', () => {
30
- // TODO: Test reactivity
31
- // const { container } = render(() => <ComponentName count={5} />);
32
- // expect(container.textContent).toContain('5');
33
- });
34
- });
1
+ import { render, screen } from '@solidjs/testing-library';
2
+ import { describe, it, expect, vi } from 'vitest';
3
+
4
+ // TODO: Import your component
5
+ // import ComponentName from '@/components/ComponentName';
6
+
7
+ describe('ComponentName', () => {
8
+ it('should render', () => {
9
+ // TODO: Add component render
10
+ // render(() => <ComponentName />);
11
+ // expect(screen.getByRole('button')).toBeInTheDocument();
12
+ });
13
+
14
+ it('should render with props', () => {
15
+ // TODO: Test props
16
+ // render(() => <ComponentName title="Test Title" />);
17
+ // expect(screen.getByText('Test Title')).toBeInTheDocument();
18
+ });
19
+
20
+ it('should handle user interaction', async () => {
21
+ // TODO: Test events
22
+ // const handleClick = vi.fn();
23
+ // render(() => <ComponentName onClick={handleClick} />);
24
+ // const button = screen.getByRole('button');
25
+ // button.click();
26
+ // expect(handleClick).toHaveBeenCalledTimes(1);
27
+ });
28
+
29
+ it('should update with reactive state', () => {
30
+ // TODO: Test reactivity
31
+ // const { container } = render(() => <ComponentName count={5} />);
32
+ // expect(container.textContent).toContain('5');
33
+ });
34
+ });