@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.
- package/LICENSE +23 -23
- package/README.md +147 -141
- package/bin/Dockerfile +75 -74
- package/dist/cli/cli.d.ts +42 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/cli/cli.js +89 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/commands/detect.command.d.ts +39 -0
- package/dist/cli/commands/detect.command.d.ts.map +1 -0
- package/dist/cli/commands/detect.command.js +111 -0
- package/dist/cli/commands/detect.command.js.map +1 -0
- package/dist/cli/commands/index.d.ts +14 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/index.js +11 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/init.command.d.ts +41 -0
- package/dist/cli/commands/init.command.d.ts.map +1 -0
- package/dist/cli/commands/init.command.js +111 -0
- package/dist/cli/commands/init.command.js.map +1 -0
- package/dist/cli/commands/test.command.d.ts +58 -0
- package/dist/cli/commands/test.command.d.ts.map +1 -0
- package/dist/cli/commands/test.command.js +180 -0
- package/dist/cli/commands/test.command.js.map +1 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +10 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/config/daemon.config.d.ts +32 -0
- package/dist/core/config/daemon.config.d.ts.map +1 -0
- package/dist/core/config/daemon.config.js +83 -0
- package/dist/core/config/daemon.config.js.map +1 -0
- package/dist/core/config/index.d.ts +5 -0
- package/dist/core/config/index.d.ts.map +1 -0
- package/dist/core/config/index.js +5 -0
- package/dist/core/config/index.js.map +1 -0
- package/dist/core/constants.d.ts +36 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/constants.js +56 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/types/common.types.d.ts +250 -0
- package/dist/core/types/common.types.d.ts.map +1 -0
- package/dist/core/types/common.types.js +7 -0
- package/dist/core/types/common.types.js.map +1 -0
- package/dist/core/types/detection.types.d.ts +232 -0
- package/dist/core/types/detection.types.d.ts.map +1 -0
- package/dist/core/types/detection.types.js +22 -0
- package/dist/core/types/detection.types.js.map +1 -0
- package/dist/core/types/docker.types.d.ts +322 -0
- package/dist/core/types/docker.types.d.ts.map +1 -0
- package/dist/core/types/docker.types.js +7 -0
- package/dist/core/types/docker.types.js.map +1 -0
- package/dist/core/types/index.d.ts +11 -0
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/core/types/index.js +7 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/core/types/project.types.d.ts +74 -0
- package/dist/core/types/project.types.d.ts.map +1 -0
- package/dist/core/types/project.types.js +7 -0
- package/dist/core/types/project.types.js.map +1 -0
- package/dist/core/types/shared.types.d.ts +118 -0
- package/dist/core/types/shared.types.d.ts.map +1 -0
- package/dist/core/types/shared.types.js +7 -0
- package/dist/core/types/shared.types.js.map +1 -0
- package/dist/core/types/test.types.d.ts +230 -0
- package/dist/core/types/test.types.d.ts.map +1 -0
- package/dist/core/types/test.types.js +7 -0
- package/dist/core/types/test.types.js.map +1 -0
- package/dist/services/detection/__tests__/framework-detector.test.d.ts +5 -0
- package/dist/services/detection/__tests__/framework-detector.test.d.ts.map +1 -0
- package/dist/services/detection/__tests__/framework-detector.test.js +52 -0
- package/dist/services/detection/__tests__/framework-detector.test.js.map +1 -0
- package/dist/services/detection/framework-detector.d.ts +179 -0
- package/dist/services/detection/framework-detector.d.ts.map +1 -0
- package/dist/services/detection/framework-detector.js +636 -0
- package/dist/services/detection/framework-detector.js.map +1 -0
- package/dist/services/detection/index.d.ts +10 -0
- package/dist/services/detection/index.d.ts.map +1 -0
- package/dist/services/detection/index.js +7 -0
- package/dist/services/detection/index.js.map +1 -0
- package/dist/services/docker/__tests__/docker-manager.test.d.ts +5 -0
- package/dist/services/docker/__tests__/docker-manager.test.d.ts.map +1 -0
- package/dist/services/docker/__tests__/docker-manager.test.js +67 -0
- package/dist/services/docker/__tests__/docker-manager.test.js.map +1 -0
- package/dist/services/docker/docker-manager.d.ts +157 -0
- package/dist/services/docker/docker-manager.d.ts.map +1 -0
- package/dist/services/docker/docker-manager.js +516 -0
- package/dist/services/docker/docker-manager.js.map +1 -0
- package/dist/services/docker/index.d.ts +9 -0
- package/dist/services/docker/index.d.ts.map +1 -0
- package/dist/services/docker/index.js +9 -0
- package/dist/services/docker/index.js.map +1 -0
- package/dist/services/index.d.ts +10 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +8 -0
- package/dist/services/index.js.map +1 -0
- package/dist/shared/errors/__tests__/base.error.test.d.ts +5 -0
- package/dist/shared/errors/__tests__/base.error.test.d.ts.map +1 -0
- package/dist/shared/errors/__tests__/base.error.test.js +61 -0
- package/dist/shared/errors/__tests__/base.error.test.js.map +1 -0
- package/dist/shared/errors/__tests__/command.error.test.d.ts +5 -0
- package/dist/shared/errors/__tests__/command.error.test.d.ts.map +1 -0
- package/dist/shared/errors/__tests__/command.error.test.js +62 -0
- package/dist/shared/errors/__tests__/command.error.test.js.map +1 -0
- package/dist/shared/errors/__tests__/file.error.test.d.ts +5 -0
- package/dist/shared/errors/__tests__/file.error.test.d.ts.map +1 -0
- package/dist/shared/errors/__tests__/file.error.test.js +75 -0
- package/dist/shared/errors/__tests__/file.error.test.js.map +1 -0
- package/dist/shared/errors/__tests__/index.test.d.ts +5 -0
- package/dist/shared/errors/__tests__/index.test.d.ts.map +1 -0
- package/dist/shared/errors/__tests__/index.test.js +62 -0
- package/dist/shared/errors/__tests__/index.test.js.map +1 -0
- package/dist/shared/errors/__tests__/validation.error.test.d.ts +5 -0
- package/dist/shared/errors/__tests__/validation.error.test.d.ts.map +1 -0
- package/dist/shared/errors/__tests__/validation.error.test.js +79 -0
- package/dist/shared/errors/__tests__/validation.error.test.js.map +1 -0
- package/dist/shared/errors/base.error.d.ts +54 -0
- package/dist/shared/errors/base.error.d.ts.map +1 -0
- package/dist/shared/errors/base.error.js +85 -0
- package/dist/shared/errors/base.error.js.map +1 -0
- package/dist/shared/errors/command.error.d.ts +58 -0
- package/dist/shared/errors/command.error.d.ts.map +1 -0
- package/dist/shared/errors/command.error.js +102 -0
- package/dist/shared/errors/command.error.js.map +1 -0
- package/dist/shared/errors/detection.error.d.ts +42 -0
- package/dist/shared/errors/detection.error.d.ts.map +1 -0
- package/dist/shared/errors/detection.error.js +82 -0
- package/dist/shared/errors/detection.error.js.map +1 -0
- package/dist/shared/errors/docker.error.d.ts +142 -0
- package/dist/shared/errors/docker.error.d.ts.map +1 -0
- package/dist/shared/errors/docker.error.js +172 -0
- package/dist/shared/errors/docker.error.js.map +1 -0
- package/dist/shared/errors/file.error.d.ts +66 -0
- package/dist/shared/errors/file.error.d.ts.map +1 -0
- package/dist/shared/errors/file.error.js +93 -0
- package/dist/shared/errors/file.error.js.map +1 -0
- package/dist/shared/errors/index.d.ts +56 -0
- package/dist/shared/errors/index.d.ts.map +1 -0
- package/dist/shared/errors/index.js +86 -0
- package/dist/shared/errors/index.js.map +1 -0
- package/dist/shared/errors/validation.error.d.ts +67 -0
- package/dist/shared/errors/validation.error.d.ts.map +1 -0
- package/dist/shared/errors/validation.error.js +97 -0
- package/dist/shared/errors/validation.error.js.map +1 -0
- package/dist/shared/templates/index.d.ts +2 -0
- package/dist/shared/templates/index.d.ts.map +1 -0
- package/dist/shared/templates/index.js +2 -0
- package/dist/shared/templates/index.js.map +1 -0
- package/dist/shared/templates/prompt-builder.d.ts +2 -0
- package/dist/shared/templates/prompt-builder.d.ts.map +1 -0
- package/dist/shared/templates/prompt-builder.js +2 -0
- package/dist/shared/templates/prompt-builder.js.map +1 -0
- package/dist/shared/templates/template-engine.d.ts +2 -0
- package/dist/shared/templates/template-engine.d.ts.map +1 -0
- package/dist/shared/templates/template-engine.js +2 -0
- package/dist/shared/templates/template-engine.js.map +1 -0
- package/dist/shared/utils/__tests__/command-executor.test.d.ts +5 -0
- package/dist/shared/utils/__tests__/command-executor.test.d.ts.map +1 -0
- package/dist/shared/utils/__tests__/command-executor.test.js +45 -0
- package/dist/shared/utils/__tests__/command-executor.test.js.map +1 -0
- package/dist/shared/utils/__tests__/file-helper.test.d.ts +5 -0
- package/dist/shared/utils/__tests__/file-helper.test.d.ts.map +1 -0
- package/dist/shared/utils/__tests__/file-helper.test.js +71 -0
- package/dist/shared/utils/__tests__/file-helper.test.js.map +1 -0
- package/dist/shared/utils/__tests__/logger.test.d.ts +5 -0
- package/dist/shared/utils/__tests__/logger.test.d.ts.map +1 -0
- package/dist/shared/utils/__tests__/logger.test.js +83 -0
- package/dist/shared/utils/__tests__/logger.test.js.map +1 -0
- package/dist/shared/utils/command-executer.d.ts +2 -0
- package/dist/shared/utils/command-executer.d.ts.map +1 -0
- package/dist/shared/utils/command-executer.js +2 -0
- package/dist/shared/utils/command-executer.js.map +1 -0
- package/dist/shared/utils/command-executor.d.ts +255 -0
- package/dist/shared/utils/command-executor.d.ts.map +1 -0
- package/dist/shared/utils/command-executor.js +287 -0
- package/dist/shared/utils/command-executor.js.map +1 -0
- package/dist/shared/utils/file-helper.d.ts +86 -0
- package/dist/shared/utils/file-helper.d.ts.map +1 -0
- package/dist/shared/utils/file-helper.js +323 -0
- package/dist/shared/utils/file-helper.js.map +1 -0
- package/dist/shared/utils/index.d.ts +9 -0
- package/dist/shared/utils/index.d.ts.map +1 -0
- package/dist/shared/utils/index.js +9 -0
- package/dist/shared/utils/index.js.map +1 -0
- package/dist/shared/utils/logger.d.ts +163 -0
- package/dist/shared/utils/logger.d.ts.map +1 -0
- package/dist/shared/utils/logger.js +389 -0
- package/dist/shared/utils/logger.js.map +1 -0
- package/package.json +53 -34
- package/prompts/DEPS_EFFICIENCY.md +558 -558
- package/prompts/E2E.md +491 -491
- package/prompts/EXECUTE.md +1060 -1060
- package/prompts/INTEGRATION_API.md +484 -484
- package/prompts/INTEGRATION_DB.md +425 -425
- package/prompts/PERF_API.md +433 -433
- package/prompts/PERF_DB.md +430 -430
- package/prompts/PERF_FRONT.md +357 -357
- package/prompts/REMEDIATION.md +482 -482
- package/prompts/UNIT.md +260 -260
- package/templates/README.md +38 -38
- package/templates/k6/load-test.js +54 -54
- package/templates/playwright/e2e.spec.ts +61 -61
- package/templates/vitest/angular-component.test.ts +38 -38
- package/templates/vitest/api.test.ts +51 -51
- package/templates/vitest/component.test.ts +27 -27
- package/templates/vitest/hook.test.ts +36 -36
- package/templates/vitest/solid-component.test.ts +34 -34
- package/templates/vitest/svelte-component.test.ts +33 -33
- package/templates/vitest/vue-component.test.ts +39 -39
- package/CHANGELOG.md +0 -38
- package/agents/deps-analyzer.js +0 -366
- package/agents/detector.js +0 -570
- package/agents/fix-engine.js +0 -305
- package/agents/lighthouse-scanner.js +0 -405
- package/agents/perf-analyzer.js +0 -294
- package/agents/perf-front-analyzer.js +0 -229
- package/agents/test-generator.js +0 -387
- package/agents/test-runner.js +0 -318
- package/bin/cli.js +0 -449
- package/lib/config.js +0 -250
- package/lib/docker.js +0 -207
- package/lib/reporter.js +0 -297
- 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
|
+
});
|