@nomad-e/bluma-cli 0.1.13 → 0.1.16
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/README.md +160 -0
- package/dist/config/models_config.json +78 -0
- package/dist/config/native_tools.json +33 -0
- package/dist/main.js +327 -85
- package/dist/skills/git-conventional/LICENSE.txt +3 -0
- package/dist/skills/git-conventional/SKILL.md +83 -0
- package/dist/skills/skill-creator/SKILL.md +495 -0
- package/dist/skills/testing/LICENSE.txt +3 -0
- package/dist/skills/testing/SKILL.md +114 -0
- package/package.json +2 -2
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testing
|
|
3
|
+
description: Testing expert. Writes and runs tests with Jest and React Testing Library.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
author: NomadEngenuity
|
|
6
|
+
license: LICENSE.txt
|
|
7
|
+
tools:
|
|
8
|
+
required:
|
|
9
|
+
- shell_command
|
|
10
|
+
- command_status
|
|
11
|
+
- message
|
|
12
|
+
recommended:
|
|
13
|
+
- read_file_lines
|
|
14
|
+
- edit_tool
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Instructions
|
|
18
|
+
|
|
19
|
+
## Context
|
|
20
|
+
You are executing the testing workflow. This skill ensures code quality through comprehensive, maintainable tests using Jest and React Testing Library.
|
|
21
|
+
|
|
22
|
+
## Procedure
|
|
23
|
+
|
|
24
|
+
### Step 1: Run Existing Tests
|
|
25
|
+
```bash
|
|
26
|
+
npm test
|
|
27
|
+
```
|
|
28
|
+
Check current test status before making changes.
|
|
29
|
+
|
|
30
|
+
### Step 2: Analyze Code to Test
|
|
31
|
+
Use `read_file_lines` to understand:
|
|
32
|
+
- Function signatures
|
|
33
|
+
- Component props
|
|
34
|
+
- Expected behavior
|
|
35
|
+
|
|
36
|
+
### Step 3: Write Tests
|
|
37
|
+
Use `edit_tool` to create test file following this structure:
|
|
38
|
+
```typescript
|
|
39
|
+
describe('ComponentName', () => {
|
|
40
|
+
beforeEach(() => {
|
|
41
|
+
// setup
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('should do expected behavior', () => {
|
|
45
|
+
// arrange
|
|
46
|
+
// act
|
|
47
|
+
// assert
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Step 4: Run Tests
|
|
53
|
+
```bash
|
|
54
|
+
npm test -- path/to/file.test.ts
|
|
55
|
+
```
|
|
56
|
+
Verify tests pass.
|
|
57
|
+
|
|
58
|
+
### Step 5: Report Result
|
|
59
|
+
- All pass: "✅ Tests passing"
|
|
60
|
+
- Failures: "❌ N tests failing" + show errors
|
|
61
|
+
|
|
62
|
+
## Reference: Jest Patterns
|
|
63
|
+
|
|
64
|
+
### Assertions
|
|
65
|
+
```typescript
|
|
66
|
+
expect(value).toBe(expected);
|
|
67
|
+
expect(value).toEqual(expected);
|
|
68
|
+
expect(value).toBeTruthy();
|
|
69
|
+
expect(array).toContain(item);
|
|
70
|
+
expect(fn).toThrow();
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Async
|
|
74
|
+
```typescript
|
|
75
|
+
it('fetches data', async () => {
|
|
76
|
+
const data = await fetchData();
|
|
77
|
+
expect(data).toBeDefined();
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Mocking
|
|
82
|
+
```typescript
|
|
83
|
+
jest.mock('./module');
|
|
84
|
+
jest.spyOn(object, 'method');
|
|
85
|
+
jest.fn().mockReturnValue(value);
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Reference: React Testing Library
|
|
89
|
+
|
|
90
|
+
### Query Priority
|
|
91
|
+
1. getByRole
|
|
92
|
+
2. getByLabelText
|
|
93
|
+
3. getByPlaceholderText
|
|
94
|
+
4. getByText
|
|
95
|
+
5. getByTestId
|
|
96
|
+
|
|
97
|
+
### Component Test
|
|
98
|
+
```typescript
|
|
99
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
100
|
+
|
|
101
|
+
it('handles click', () => {
|
|
102
|
+
render(<Button onClick={handleClick}>Click</Button>);
|
|
103
|
+
fireEvent.click(screen.getByRole('button'));
|
|
104
|
+
expect(handleClick).toHaveBeenCalled();
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Error Reference
|
|
109
|
+
|
|
110
|
+
| Error | Cause | Fix |
|
|
111
|
+
|-------|-------|-----|
|
|
112
|
+
| Cannot find module | Missing dependency | `npm install` |
|
|
113
|
+
| Timeout | Async not awaited | Add `async/await` |
|
|
114
|
+
| Not wrapped in act | State update | Wrap in `act()` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomad-e/bluma-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "BluMa independent agent for automation and advanced software engineering.",
|
|
5
5
|
"author": "Alex Fonseca",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"main": "dist/main.js",
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "node scripts/build.js",
|
|
34
|
-
"start": "node dist/main.js",
|
|
34
|
+
"start": "node scripts/build.js && clear && node dist/main.js",
|
|
35
35
|
"test": "jest",
|
|
36
36
|
"test:watch": "jest --watch",
|
|
37
37
|
"lint": "eslint src --ext .ts,.tsx",
|