@oalacea/daemon 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -38
- package/LICENSE +23 -23
- package/README.md +147 -141
- package/agents/deps-analyzer.js +366 -366
- package/agents/detector.js +570 -570
- package/agents/fix-engine.js +305 -305
- package/agents/lighthouse-scanner.js +405 -405
- package/agents/perf-analyzer.js +294 -294
- package/agents/perf-front-analyzer.js +229 -229
- package/agents/test-generator.js +387 -387
- package/agents/test-runner.js +318 -318
- package/bin/Dockerfile +75 -74
- package/bin/cli.js +449 -449
- package/lib/config.js +250 -250
- package/lib/docker.js +207 -207
- package/lib/reporter.js +297 -297
- package/package.json +34 -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/scripts/dev.js +106 -106
- 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
|
@@ -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
|
+
});
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
3
|
-
|
|
4
|
-
// TODO: Import your component
|
|
5
|
-
// import ComponentName from '@/components/ComponentName.svelte';
|
|
6
|
-
|
|
7
|
-
describe('ComponentName', () => {
|
|
8
|
-
it('should render', () => {
|
|
9
|
-
// TODO: Add component render
|
|
10
|
-
// render(ComponentName);
|
|
11
|
-
// expect(container).toBeTruthy();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('should render with props', () => {
|
|
15
|
-
// TODO: Test props
|
|
16
|
-
// const { container } = render(ComponentName, { props: { title: 'Test Title' } });
|
|
17
|
-
// expect(container.textContent).toContain('Test Title');
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should handle user interaction', async () => {
|
|
21
|
-
// TODO: Test events
|
|
22
|
-
// const { container, component } = render(ComponentName);
|
|
23
|
-
// const button = container.querySelector('button');
|
|
24
|
-
// button.click();
|
|
25
|
-
// expect(component.$$).toBeDefined();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should update when props change', async () => {
|
|
29
|
-
// TODO: Test reactivity
|
|
30
|
-
// const { container } = render(ComponentName, { props: { count: 0 } });
|
|
31
|
-
// // Update props and check reactivity
|
|
32
|
-
});
|
|
33
|
-
});
|
|
1
|
+
import { render, screen } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
3
|
+
|
|
4
|
+
// TODO: Import your component
|
|
5
|
+
// import ComponentName from '@/components/ComponentName.svelte';
|
|
6
|
+
|
|
7
|
+
describe('ComponentName', () => {
|
|
8
|
+
it('should render', () => {
|
|
9
|
+
// TODO: Add component render
|
|
10
|
+
// render(ComponentName);
|
|
11
|
+
// expect(container).toBeTruthy();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should render with props', () => {
|
|
15
|
+
// TODO: Test props
|
|
16
|
+
// const { container } = render(ComponentName, { props: { title: 'Test Title' } });
|
|
17
|
+
// expect(container.textContent).toContain('Test Title');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should handle user interaction', async () => {
|
|
21
|
+
// TODO: Test events
|
|
22
|
+
// const { container, component } = render(ComponentName);
|
|
23
|
+
// const button = container.querySelector('button');
|
|
24
|
+
// button.click();
|
|
25
|
+
// expect(component.$$).toBeDefined();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should update when props change', async () => {
|
|
29
|
+
// TODO: Test reactivity
|
|
30
|
+
// const { container } = render(ComponentName, { props: { count: 0 } });
|
|
31
|
+
// // Update props and check reactivity
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { mount } from '@vue/test-utils';
|
|
2
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
3
|
-
|
|
4
|
-
// TODO: Import your component
|
|
5
|
-
// import ComponentName from '@/components/ComponentName.vue';
|
|
6
|
-
|
|
7
|
-
describe('ComponentName', () => {
|
|
8
|
-
it('should render', () => {
|
|
9
|
-
// TODO: Add component render
|
|
10
|
-
// const wrapper = mount(ComponentName);
|
|
11
|
-
// expect(wrapper.exists()).toBe(true);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('should render with props', () => {
|
|
15
|
-
// TODO: Test props
|
|
16
|
-
// const wrapper = mount(ComponentName, {
|
|
17
|
-
// props: { title: 'Test Title' }
|
|
18
|
-
// });
|
|
19
|
-
// expect(wrapper.text()).toContain('Test Title');
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should handle user interaction', async () => {
|
|
23
|
-
// TODO: Test events
|
|
24
|
-
// const wrapper = mount(ComponentName, {
|
|
25
|
-
// props: { onClick: vi.fn() }
|
|
26
|
-
// });
|
|
27
|
-
// await wrapper.find('button').trigger('click');
|
|
28
|
-
// expect(wrapper.emitted('click')).toBeTruthy();
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should update when props change', async () => {
|
|
32
|
-
// TODO: Test reactivity
|
|
33
|
-
// const wrapper = mount(ComponentName, {
|
|
34
|
-
// props: { count: 0 }
|
|
35
|
-
// });
|
|
36
|
-
// await wrapper.setProps({ count: 5 });
|
|
37
|
-
// expect(wrapper.text()).toContain('5');
|
|
38
|
-
});
|
|
39
|
-
});
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
3
|
+
|
|
4
|
+
// TODO: Import your component
|
|
5
|
+
// import ComponentName from '@/components/ComponentName.vue';
|
|
6
|
+
|
|
7
|
+
describe('ComponentName', () => {
|
|
8
|
+
it('should render', () => {
|
|
9
|
+
// TODO: Add component render
|
|
10
|
+
// const wrapper = mount(ComponentName);
|
|
11
|
+
// expect(wrapper.exists()).toBe(true);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should render with props', () => {
|
|
15
|
+
// TODO: Test props
|
|
16
|
+
// const wrapper = mount(ComponentName, {
|
|
17
|
+
// props: { title: 'Test Title' }
|
|
18
|
+
// });
|
|
19
|
+
// expect(wrapper.text()).toContain('Test Title');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should handle user interaction', async () => {
|
|
23
|
+
// TODO: Test events
|
|
24
|
+
// const wrapper = mount(ComponentName, {
|
|
25
|
+
// props: { onClick: vi.fn() }
|
|
26
|
+
// });
|
|
27
|
+
// await wrapper.find('button').trigger('click');
|
|
28
|
+
// expect(wrapper.emitted('click')).toBeTruthy();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should update when props change', async () => {
|
|
32
|
+
// TODO: Test reactivity
|
|
33
|
+
// const wrapper = mount(ComponentName, {
|
|
34
|
+
// props: { count: 0 }
|
|
35
|
+
// });
|
|
36
|
+
// await wrapper.setProps({ count: 5 });
|
|
37
|
+
// expect(wrapper.text()).toContain('5');
|
|
38
|
+
});
|
|
39
|
+
});
|