smithers-orchestrator 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/preload.ts +1 -1
- package/src/components/Git/Commit.test.tsx +109 -0
- package/src/components/Git/Notes.test.tsx +92 -0
- package/src/components/Hooks/OnCIFailure.test.tsx +110 -0
- package/src/components/Hooks/PostCommit.test.tsx +75 -0
- package/src/components/JJ/Commit.test.tsx +56 -0
- package/src/components/JJ/Describe.test.tsx +49 -0
- package/src/components/JJ/Rebase.test.tsx +67 -0
- package/src/components/JJ/Snapshot.test.tsx +42 -0
- package/src/components/JJ/Status.test.tsx +56 -0
- package/src/components/components.test.tsx +36 -45
package/package.json
CHANGED
package/preload.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { SolidPlugin } from "@dschz/bun-plugin-solid";
|
|
|
2
2
|
|
|
3
3
|
await Bun.plugin(
|
|
4
4
|
SolidPlugin({
|
|
5
|
-
generate: "
|
|
5
|
+
generate: "universal", // For custom renderers using solid-js/universal
|
|
6
6
|
hydratable: false,
|
|
7
7
|
debug: false,
|
|
8
8
|
}),
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for Git/Commit.tsx - Git commit component interface tests.
|
|
3
|
+
*/
|
|
4
|
+
import { describe, test, expect, mock } from 'bun:test'
|
|
5
|
+
import type { CommitProps, CommitResult } from './Commit'
|
|
6
|
+
|
|
7
|
+
describe('CommitProps interface', () => {
|
|
8
|
+
test('message is optional', () => {
|
|
9
|
+
const props: CommitProps = {}
|
|
10
|
+
expect(props.message).toBeUndefined()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
test('message can be set', () => {
|
|
14
|
+
const props: CommitProps = { message: 'Add new feature' }
|
|
15
|
+
expect(props.message).toBe('Add new feature')
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('autoGenerate is optional boolean', () => {
|
|
19
|
+
const props: CommitProps = { autoGenerate: true }
|
|
20
|
+
expect(props.autoGenerate).toBe(true)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
test('notes is optional object', () => {
|
|
24
|
+
const props: CommitProps = { notes: { key: 'value', number: 42 } }
|
|
25
|
+
expect(props.notes?.key).toBe('value')
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('files is optional string array', () => {
|
|
29
|
+
const props: CommitProps = { files: ['file1.ts', 'file2.ts'] }
|
|
30
|
+
expect(props.files).toHaveLength(2)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test('all is optional boolean for -a flag', () => {
|
|
34
|
+
const props: CommitProps = { all: true }
|
|
35
|
+
expect(props.all).toBe(true)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('children can be used as message', () => {
|
|
39
|
+
const props: CommitProps = { children: 'Commit message via children' }
|
|
40
|
+
expect(props.children).toBe('Commit message via children')
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test('onFinished callback receives CommitResult', () => {
|
|
44
|
+
const callback = mock(() => {})
|
|
45
|
+
const props: CommitProps = { onFinished: callback }
|
|
46
|
+
|
|
47
|
+
const result: CommitResult = {
|
|
48
|
+
commitHash: 'abc123',
|
|
49
|
+
message: 'Test commit',
|
|
50
|
+
filesChanged: ['file.ts'],
|
|
51
|
+
insertions: 10,
|
|
52
|
+
deletions: 5,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
props.onFinished?.(result)
|
|
56
|
+
expect(callback).toHaveBeenCalledWith(result)
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
test('onError callback receives Error', () => {
|
|
60
|
+
const callback = mock(() => {})
|
|
61
|
+
const props: CommitProps = { onError: callback }
|
|
62
|
+
|
|
63
|
+
const error = new Error('Commit failed')
|
|
64
|
+
props.onError?.(error)
|
|
65
|
+
expect(callback).toHaveBeenCalledWith(error)
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
describe('CommitResult interface', () => {
|
|
70
|
+
test('has all required fields', () => {
|
|
71
|
+
const result: CommitResult = {
|
|
72
|
+
commitHash: 'abc123def456',
|
|
73
|
+
message: 'Feature: add new capability',
|
|
74
|
+
filesChanged: ['src/index.ts', 'src/utils.ts'],
|
|
75
|
+
insertions: 100,
|
|
76
|
+
deletions: 50,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
expect(result.commitHash).toBe('abc123def456')
|
|
80
|
+
expect(result.message).toBe('Feature: add new capability')
|
|
81
|
+
expect(result.filesChanged).toHaveLength(2)
|
|
82
|
+
expect(result.insertions).toBe(100)
|
|
83
|
+
expect(result.deletions).toBe(50)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
test('filesChanged can be empty', () => {
|
|
87
|
+
const result: CommitResult = {
|
|
88
|
+
commitHash: 'abc123',
|
|
89
|
+
message: 'Empty commit',
|
|
90
|
+
filesChanged: [],
|
|
91
|
+
insertions: 0,
|
|
92
|
+
deletions: 0,
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
expect(result.filesChanged).toHaveLength(0)
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
describe('Commit component', () => {
|
|
100
|
+
test('exports Commit function', async () => {
|
|
101
|
+
const { Commit } = await import('./Commit')
|
|
102
|
+
expect(typeof Commit).toBe('function')
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
test('Commit is a valid Solid component', async () => {
|
|
106
|
+
const { Commit } = await import('./Commit')
|
|
107
|
+
expect(Commit.length).toBeLessThanOrEqual(1)
|
|
108
|
+
})
|
|
109
|
+
})
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for Git/Notes.tsx - Git notes component interface tests.
|
|
3
|
+
*/
|
|
4
|
+
import { describe, test, expect, mock } from 'bun:test'
|
|
5
|
+
import type { NotesProps, NotesResult } from './Notes'
|
|
6
|
+
|
|
7
|
+
describe('NotesProps interface', () => {
|
|
8
|
+
test('commitRef is optional, defaults to HEAD', () => {
|
|
9
|
+
const props: NotesProps = { data: { key: 'value' } }
|
|
10
|
+
expect(props.commitRef).toBeUndefined()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
test('commitRef can be set', () => {
|
|
14
|
+
const props: NotesProps = { commitRef: 'abc123', data: {} }
|
|
15
|
+
expect(props.commitRef).toBe('abc123')
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('data is required object', () => {
|
|
19
|
+
const props: NotesProps = { data: { smithers: true, version: '1.0' } }
|
|
20
|
+
expect(props.data.smithers).toBe(true)
|
|
21
|
+
expect(props.data.version).toBe('1.0')
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
test('append is optional boolean', () => {
|
|
25
|
+
const props: NotesProps = { data: {}, append: true }
|
|
26
|
+
expect(props.append).toBe(true)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test('append defaults to false (replace)', () => {
|
|
30
|
+
const props: NotesProps = { data: {} }
|
|
31
|
+
expect(props.append).toBeUndefined() // Will default to false in component
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('onFinished callback receives NotesResult', () => {
|
|
35
|
+
const callback = mock(() => {})
|
|
36
|
+
const props: NotesProps = { data: {}, onFinished: callback }
|
|
37
|
+
|
|
38
|
+
const result: NotesResult = {
|
|
39
|
+
commitRef: 'HEAD',
|
|
40
|
+
data: { smithers: true },
|
|
41
|
+
previousNotes: null,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
props.onFinished?.(result)
|
|
45
|
+
expect(callback).toHaveBeenCalledWith(result)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test('onError callback receives Error', () => {
|
|
49
|
+
const callback = mock(() => {})
|
|
50
|
+
const props: NotesProps = { data: {}, onError: callback }
|
|
51
|
+
|
|
52
|
+
const error = new Error('Notes failed')
|
|
53
|
+
props.onError?.(error)
|
|
54
|
+
expect(callback).toHaveBeenCalledWith(error)
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
describe('NotesResult interface', () => {
|
|
59
|
+
test('has all required fields', () => {
|
|
60
|
+
const result: NotesResult = {
|
|
61
|
+
commitRef: 'abc123',
|
|
62
|
+
data: { smithers: true, executionId: 'exec-1' },
|
|
63
|
+
previousNotes: null,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
expect(result.commitRef).toBe('abc123')
|
|
67
|
+
expect(result.data.smithers).toBe(true)
|
|
68
|
+
expect(result.previousNotes).toBeNull()
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
test('previousNotes can contain prior notes when appending', () => {
|
|
72
|
+
const result: NotesResult = {
|
|
73
|
+
commitRef: 'HEAD',
|
|
74
|
+
data: { newData: true },
|
|
75
|
+
previousNotes: '{"oldData": true}',
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
expect(result.previousNotes).toBe('{"oldData": true}')
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
describe('Notes component', () => {
|
|
83
|
+
test('exports Notes function', async () => {
|
|
84
|
+
const { Notes } = await import('./Notes')
|
|
85
|
+
expect(typeof Notes).toBe('function')
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
test('Notes is a valid Solid component', async () => {
|
|
89
|
+
const { Notes } = await import('./Notes')
|
|
90
|
+
expect(Notes.length).toBeLessThanOrEqual(1)
|
|
91
|
+
})
|
|
92
|
+
})
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for Hooks/OnCIFailure.tsx - CI failure hook component interface tests.
|
|
3
|
+
*/
|
|
4
|
+
import { describe, test, expect, mock } from 'bun:test'
|
|
5
|
+
import type { OnCIFailureProps, CIFailure } from './OnCIFailure'
|
|
6
|
+
|
|
7
|
+
describe('OnCIFailureProps interface', () => {
|
|
8
|
+
test('provider is required', () => {
|
|
9
|
+
const props: OnCIFailureProps = {
|
|
10
|
+
provider: 'github-actions',
|
|
11
|
+
children: null as any,
|
|
12
|
+
}
|
|
13
|
+
expect(props.provider).toBe('github-actions')
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
test('pollInterval is optional', () => {
|
|
17
|
+
const props: OnCIFailureProps = {
|
|
18
|
+
provider: 'github-actions',
|
|
19
|
+
children: null as any,
|
|
20
|
+
}
|
|
21
|
+
expect(props.pollInterval).toBeUndefined()
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
test('pollInterval can be set', () => {
|
|
25
|
+
const props: OnCIFailureProps = {
|
|
26
|
+
provider: 'github-actions',
|
|
27
|
+
pollInterval: 60000,
|
|
28
|
+
children: null as any,
|
|
29
|
+
}
|
|
30
|
+
expect(props.pollInterval).toBe(60000)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test('onFailure is optional callback', () => {
|
|
34
|
+
const callback = mock(() => {})
|
|
35
|
+
const props: OnCIFailureProps = {
|
|
36
|
+
provider: 'github-actions',
|
|
37
|
+
onFailure: callback,
|
|
38
|
+
children: null as any,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const failure: CIFailure = {
|
|
42
|
+
failed: true,
|
|
43
|
+
runId: '12345',
|
|
44
|
+
workflowName: 'CI',
|
|
45
|
+
failedJobs: ['test', 'lint'],
|
|
46
|
+
logs: 'Error: test failed',
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
props.onFailure?.(failure)
|
|
50
|
+
expect(callback).toHaveBeenCalledWith(failure)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
test('children is required', () => {
|
|
54
|
+
const props: OnCIFailureProps = {
|
|
55
|
+
provider: 'github-actions',
|
|
56
|
+
children: null as any,
|
|
57
|
+
}
|
|
58
|
+
expect(props.children).toBeNull()
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
describe('CIFailure interface', () => {
|
|
63
|
+
test('minimal failure', () => {
|
|
64
|
+
const failure: CIFailure = {
|
|
65
|
+
failed: true,
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
expect(failure.failed).toBe(true)
|
|
69
|
+
expect(failure.runId).toBeUndefined()
|
|
70
|
+
expect(failure.workflowName).toBeUndefined()
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
test('full failure with all fields', () => {
|
|
74
|
+
const failure: CIFailure = {
|
|
75
|
+
failed: true,
|
|
76
|
+
runId: '123456789',
|
|
77
|
+
workflowName: 'Build and Test',
|
|
78
|
+
failedJobs: ['unit-tests', 'integration-tests'],
|
|
79
|
+
logs: 'Test failed at line 42',
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
expect(failure.failed).toBe(true)
|
|
83
|
+
expect(failure.runId).toBe('123456789')
|
|
84
|
+
expect(failure.workflowName).toBe('Build and Test')
|
|
85
|
+
expect(failure.failedJobs).toHaveLength(2)
|
|
86
|
+
expect(failure.logs).toContain('line 42')
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
test('failure with empty failedJobs', () => {
|
|
90
|
+
const failure: CIFailure = {
|
|
91
|
+
failed: true,
|
|
92
|
+
runId: '123',
|
|
93
|
+
failedJobs: [],
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
expect(failure.failedJobs).toHaveLength(0)
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
describe('OnCIFailure component', () => {
|
|
101
|
+
test('exports OnCIFailure function', async () => {
|
|
102
|
+
const { OnCIFailure } = await import('./OnCIFailure')
|
|
103
|
+
expect(typeof OnCIFailure).toBe('function')
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
test('OnCIFailure is a valid Solid component', async () => {
|
|
107
|
+
const { OnCIFailure } = await import('./OnCIFailure')
|
|
108
|
+
expect(OnCIFailure.length).toBeLessThanOrEqual(1)
|
|
109
|
+
})
|
|
110
|
+
})
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for Hooks/PostCommit.tsx - Post commit hook component interface tests.
|
|
3
|
+
*/
|
|
4
|
+
import { describe, test, expect, mock } from 'bun:test'
|
|
5
|
+
import type { PostCommitProps } from './PostCommit'
|
|
6
|
+
|
|
7
|
+
describe('PostCommitProps interface', () => {
|
|
8
|
+
test('children is required', () => {
|
|
9
|
+
const props: PostCommitProps = {
|
|
10
|
+
children: null as any,
|
|
11
|
+
}
|
|
12
|
+
expect(props.children).toBeNull()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test('runOn is optional', () => {
|
|
16
|
+
const props: PostCommitProps = {
|
|
17
|
+
children: null as any,
|
|
18
|
+
}
|
|
19
|
+
expect(props.runOn).toBeUndefined()
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test('runOn can be all', () => {
|
|
23
|
+
const props: PostCommitProps = {
|
|
24
|
+
children: null as any,
|
|
25
|
+
runOn: 'all',
|
|
26
|
+
}
|
|
27
|
+
expect(props.runOn).toBe('all')
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
test('runOn can be smithers-only', () => {
|
|
31
|
+
const props: PostCommitProps = {
|
|
32
|
+
children: null as any,
|
|
33
|
+
runOn: 'smithers-only',
|
|
34
|
+
}
|
|
35
|
+
expect(props.runOn).toBe('smithers-only')
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('async is optional boolean', () => {
|
|
39
|
+
const props: PostCommitProps = {
|
|
40
|
+
children: null as any,
|
|
41
|
+
}
|
|
42
|
+
expect(props.async).toBeUndefined()
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
test('async can be true', () => {
|
|
46
|
+
const props: PostCommitProps = {
|
|
47
|
+
children: null as any,
|
|
48
|
+
async: true,
|
|
49
|
+
}
|
|
50
|
+
expect(props.async).toBe(true)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
test('all props together', () => {
|
|
54
|
+
const props: PostCommitProps = {
|
|
55
|
+
children: null as any,
|
|
56
|
+
runOn: 'smithers-only',
|
|
57
|
+
async: true,
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
expect(props.runOn).toBe('smithers-only')
|
|
61
|
+
expect(props.async).toBe(true)
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
describe('PostCommit component', () => {
|
|
66
|
+
test('exports PostCommit function', async () => {
|
|
67
|
+
const { PostCommit } = await import('./PostCommit')
|
|
68
|
+
expect(typeof PostCommit).toBe('function')
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
test('PostCommit is a valid Solid component', async () => {
|
|
72
|
+
const { PostCommit } = await import('./PostCommit')
|
|
73
|
+
expect(PostCommit.length).toBeLessThanOrEqual(1)
|
|
74
|
+
})
|
|
75
|
+
})
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for JJ/Commit.tsx - JJ commit component interface tests.
|
|
3
|
+
*/
|
|
4
|
+
import { describe, test, expect, mock } from 'bun:test'
|
|
5
|
+
import type { CommitProps } from './Commit'
|
|
6
|
+
|
|
7
|
+
describe('CommitProps interface', () => {
|
|
8
|
+
test('message is optional string', () => {
|
|
9
|
+
const props: CommitProps = {}
|
|
10
|
+
expect(props.message).toBeUndefined()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
test('message can be set', () => {
|
|
14
|
+
const props: CommitProps = { message: 'Add new feature' }
|
|
15
|
+
expect(props.message).toBe('Add new feature')
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('autoDescribe is optional boolean', () => {
|
|
19
|
+
const props: CommitProps = { autoDescribe: true }
|
|
20
|
+
expect(props.autoDescribe).toBe(true)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
test('notes is optional string', () => {
|
|
24
|
+
const props: CommitProps = { notes: 'Additional metadata' }
|
|
25
|
+
expect(props.notes).toBe('Additional metadata')
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('children is optional', () => {
|
|
29
|
+
const props: CommitProps = {}
|
|
30
|
+
expect(props.children).toBeUndefined()
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test('all props together', () => {
|
|
34
|
+
const props: CommitProps = {
|
|
35
|
+
message: 'Feature commit',
|
|
36
|
+
autoDescribe: false,
|
|
37
|
+
notes: '{"key": "value"}',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
expect(props.message).toBe('Feature commit')
|
|
41
|
+
expect(props.autoDescribe).toBe(false)
|
|
42
|
+
expect(props.notes).toBe('{"key": "value"}')
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
describe('Commit component', () => {
|
|
47
|
+
test('exports Commit function', async () => {
|
|
48
|
+
const { Commit } = await import('./Commit')
|
|
49
|
+
expect(typeof Commit).toBe('function')
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
test('Commit is a valid Solid component', async () => {
|
|
53
|
+
const { Commit } = await import('./Commit')
|
|
54
|
+
expect(Commit.length).toBeLessThanOrEqual(1)
|
|
55
|
+
})
|
|
56
|
+
})
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for JJ/Describe.tsx - JJ describe component interface tests.
|
|
3
|
+
*/
|
|
4
|
+
import { describe, test, expect, mock } from 'bun:test'
|
|
5
|
+
import type { DescribeProps } from './Describe'
|
|
6
|
+
|
|
7
|
+
describe('DescribeProps interface', () => {
|
|
8
|
+
test('useAgent is optional', () => {
|
|
9
|
+
const props: DescribeProps = {}
|
|
10
|
+
expect(props.useAgent).toBeUndefined()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
test('useAgent can be claude', () => {
|
|
14
|
+
const props: DescribeProps = { useAgent: 'claude' }
|
|
15
|
+
expect(props.useAgent).toBe('claude')
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('template is optional string', () => {
|
|
19
|
+
const props: DescribeProps = { template: 'feat: {summary}' }
|
|
20
|
+
expect(props.template).toBe('feat: {summary}')
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
test('children is optional', () => {
|
|
24
|
+
const props: DescribeProps = {}
|
|
25
|
+
expect(props.children).toBeUndefined()
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('all props together', () => {
|
|
29
|
+
const props: DescribeProps = {
|
|
30
|
+
useAgent: 'claude',
|
|
31
|
+
template: 'conventional-commits',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
expect(props.useAgent).toBe('claude')
|
|
35
|
+
expect(props.template).toBe('conventional-commits')
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
describe('Describe component', () => {
|
|
40
|
+
test('exports Describe function', async () => {
|
|
41
|
+
const { Describe } = await import('./Describe')
|
|
42
|
+
expect(typeof Describe).toBe('function')
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
test('Describe is a valid Solid component', async () => {
|
|
46
|
+
const { Describe } = await import('./Describe')
|
|
47
|
+
expect(Describe.length).toBeLessThanOrEqual(1)
|
|
48
|
+
})
|
|
49
|
+
})
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for JJ/Rebase.tsx - JJ rebase component interface tests.
|
|
3
|
+
*/
|
|
4
|
+
import { describe, test, expect, mock } from 'bun:test'
|
|
5
|
+
import type { RebaseProps } from './Rebase'
|
|
6
|
+
|
|
7
|
+
describe('RebaseProps interface', () => {
|
|
8
|
+
test('destination is optional', () => {
|
|
9
|
+
const props: RebaseProps = {}
|
|
10
|
+
expect(props.destination).toBeUndefined()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
test('destination can be set', () => {
|
|
14
|
+
const props: RebaseProps = { destination: 'main' }
|
|
15
|
+
expect(props.destination).toBe('main')
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('source is optional', () => {
|
|
19
|
+
const props: RebaseProps = {}
|
|
20
|
+
expect(props.source).toBeUndefined()
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
test('source can be set', () => {
|
|
24
|
+
const props: RebaseProps = { source: 'feature-branch' }
|
|
25
|
+
expect(props.source).toBe('feature-branch')
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('onConflict is optional callback', () => {
|
|
29
|
+
const callback = mock(() => {})
|
|
30
|
+
const props: RebaseProps = { onConflict: callback }
|
|
31
|
+
|
|
32
|
+
const conflicts = ['file1.ts', 'file2.ts']
|
|
33
|
+
props.onConflict?.(conflicts)
|
|
34
|
+
|
|
35
|
+
expect(callback).toHaveBeenCalledWith(conflicts)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('children is optional', () => {
|
|
39
|
+
const props: RebaseProps = {}
|
|
40
|
+
expect(props.children).toBeUndefined()
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test('all props together', () => {
|
|
44
|
+
const onConflict = mock(() => {})
|
|
45
|
+
const props: RebaseProps = {
|
|
46
|
+
destination: 'main',
|
|
47
|
+
source: 'feature',
|
|
48
|
+
onConflict,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
expect(props.destination).toBe('main')
|
|
52
|
+
expect(props.source).toBe('feature')
|
|
53
|
+
expect(props.onConflict).toBeDefined()
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
describe('Rebase component', () => {
|
|
58
|
+
test('exports Rebase function', async () => {
|
|
59
|
+
const { Rebase } = await import('./Rebase')
|
|
60
|
+
expect(typeof Rebase).toBe('function')
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
test('Rebase is a valid Solid component', async () => {
|
|
64
|
+
const { Rebase } = await import('./Rebase')
|
|
65
|
+
expect(Rebase.length).toBeLessThanOrEqual(1)
|
|
66
|
+
})
|
|
67
|
+
})
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for JJ/Snapshot.tsx - JJ snapshot component interface tests.
|
|
3
|
+
*/
|
|
4
|
+
import { describe, test, expect } from 'bun:test'
|
|
5
|
+
import type { SnapshotProps } from './Snapshot'
|
|
6
|
+
|
|
7
|
+
describe('SnapshotProps interface', () => {
|
|
8
|
+
test('message is optional', () => {
|
|
9
|
+
const props: SnapshotProps = {}
|
|
10
|
+
expect(props.message).toBeUndefined()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
test('message can be set', () => {
|
|
14
|
+
const props: SnapshotProps = { message: 'Snapshot before refactoring' }
|
|
15
|
+
expect(props.message).toBe('Snapshot before refactoring')
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('children is optional', () => {
|
|
19
|
+
const props: SnapshotProps = {}
|
|
20
|
+
expect(props.children).toBeUndefined()
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
test('all props together', () => {
|
|
24
|
+
const props: SnapshotProps = {
|
|
25
|
+
message: 'Pre-deploy snapshot',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
expect(props.message).toBe('Pre-deploy snapshot')
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
describe('Snapshot component', () => {
|
|
33
|
+
test('exports Snapshot function', async () => {
|
|
34
|
+
const { Snapshot } = await import('./Snapshot')
|
|
35
|
+
expect(typeof Snapshot).toBe('function')
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('Snapshot is a valid Solid component', async () => {
|
|
39
|
+
const { Snapshot } = await import('./Snapshot')
|
|
40
|
+
expect(Snapshot.length).toBeLessThanOrEqual(1)
|
|
41
|
+
})
|
|
42
|
+
})
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for JJ/Status.tsx - JJ status component interface tests.
|
|
3
|
+
*/
|
|
4
|
+
import { describe, test, expect, mock } from 'bun:test'
|
|
5
|
+
import type { StatusProps } from './Status'
|
|
6
|
+
|
|
7
|
+
describe('StatusProps interface', () => {
|
|
8
|
+
test('onDirty is optional callback', () => {
|
|
9
|
+
const callback = mock(() => {})
|
|
10
|
+
const props: StatusProps = { onDirty: callback }
|
|
11
|
+
|
|
12
|
+
const status = {
|
|
13
|
+
modified: ['file1.ts'],
|
|
14
|
+
added: ['file2.ts'],
|
|
15
|
+
deleted: [],
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
props.onDirty?.(status)
|
|
19
|
+
expect(callback).toHaveBeenCalledWith(status)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test('onClean is optional callback', () => {
|
|
23
|
+
const callback = mock(() => {})
|
|
24
|
+
const props: StatusProps = { onClean: callback }
|
|
25
|
+
|
|
26
|
+
props.onClean?.()
|
|
27
|
+
expect(callback).toHaveBeenCalled()
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
test('children is optional', () => {
|
|
31
|
+
const props: StatusProps = {}
|
|
32
|
+
expect(props.children).toBeUndefined()
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
test('all props together', () => {
|
|
36
|
+
const onDirty = mock(() => {})
|
|
37
|
+
const onClean = mock(() => {})
|
|
38
|
+
|
|
39
|
+
const props: StatusProps = { onDirty, onClean }
|
|
40
|
+
|
|
41
|
+
expect(props.onDirty).toBeDefined()
|
|
42
|
+
expect(props.onClean).toBeDefined()
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
describe('Status component', () => {
|
|
47
|
+
test('exports Status function', async () => {
|
|
48
|
+
const { Status } = await import('./Status')
|
|
49
|
+
expect(typeof Status).toBe('function')
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
test('Status is a valid Solid component', async () => {
|
|
53
|
+
const { Status } = await import('./Status')
|
|
54
|
+
expect(Status.length).toBeLessThanOrEqual(1)
|
|
55
|
+
})
|
|
56
|
+
})
|
|
@@ -1,29 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Unit tests for components -
|
|
2
|
+
* Unit tests for components - using intrinsic elements to avoid Solid JSX issues.
|
|
3
|
+
* Component interface tests are in individual *.test.tsx files.
|
|
3
4
|
*/
|
|
4
5
|
import { describe, test, expect } from 'bun:test'
|
|
5
6
|
import { serialize } from '../core/serialize'
|
|
6
7
|
import { jsx } from '../jsx-runtime'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { Step } from './Step'
|
|
10
|
-
import { Stop } from './Stop'
|
|
11
|
-
import { Persona } from './Persona'
|
|
12
|
-
import { Constraints } from './Constraints'
|
|
13
|
-
import { Task } from './Task'
|
|
14
|
-
import { Human } from './Human'
|
|
15
|
-
import { Subagent } from './Subagent'
|
|
16
|
-
import { ClaudeApi } from './ClaudeApi'
|
|
17
|
-
|
|
18
|
-
describe('Phase component', () => {
|
|
8
|
+
|
|
9
|
+
describe('Phase element', () => {
|
|
19
10
|
test('creates phase element with name prop', () => {
|
|
20
|
-
const node = jsx(
|
|
11
|
+
const node = jsx('phase', { name: 'research' })
|
|
21
12
|
expect(node.type).toBe('phase')
|
|
22
13
|
expect(node.props.name).toBe('research')
|
|
23
14
|
})
|
|
24
15
|
|
|
25
16
|
test('spreads additional props', () => {
|
|
26
|
-
const node = jsx(
|
|
17
|
+
const node = jsx('phase', { name: 'test', count: 42, enabled: true })
|
|
27
18
|
expect(node.props.name).toBe('test')
|
|
28
19
|
expect(node.props.count).toBe(42)
|
|
29
20
|
expect(node.props.enabled).toBe(true)
|
|
@@ -31,113 +22,113 @@ describe('Phase component', () => {
|
|
|
31
22
|
|
|
32
23
|
test('renders children', () => {
|
|
33
24
|
const child = jsx('step', { children: 'Step content' })
|
|
34
|
-
const node = jsx(
|
|
25
|
+
const node = jsx('phase', { name: 'test', children: child })
|
|
35
26
|
expect(node.children).toHaveLength(1)
|
|
36
27
|
})
|
|
37
28
|
})
|
|
38
29
|
|
|
39
|
-
describe('Step
|
|
30
|
+
describe('Step element', () => {
|
|
40
31
|
test('creates step element', () => {
|
|
41
|
-
const node = jsx(
|
|
32
|
+
const node = jsx('step', { children: 'Do something' })
|
|
42
33
|
expect(node.type).toBe('step')
|
|
43
34
|
})
|
|
44
35
|
|
|
45
36
|
test('renders text children', () => {
|
|
46
|
-
const node = jsx(
|
|
37
|
+
const node = jsx('step', { children: 'Read the docs' })
|
|
47
38
|
expect(node.children).toHaveLength(1)
|
|
48
39
|
expect(node.children[0].type).toBe('TEXT')
|
|
49
40
|
})
|
|
50
41
|
})
|
|
51
42
|
|
|
52
|
-
describe('Stop
|
|
53
|
-
test('creates
|
|
54
|
-
const node = jsx(
|
|
43
|
+
describe('Stop element', () => {
|
|
44
|
+
test('creates stop element', () => {
|
|
45
|
+
const node = jsx('smithers-stop', { reason: 'All done' })
|
|
55
46
|
expect(node.type).toBe('smithers-stop')
|
|
56
47
|
expect(node.props.reason).toBe('All done')
|
|
57
48
|
})
|
|
58
49
|
|
|
59
50
|
test('works without reason', () => {
|
|
60
|
-
const node = jsx(
|
|
51
|
+
const node = jsx('smithers-stop', {})
|
|
61
52
|
expect(node.type).toBe('smithers-stop')
|
|
62
53
|
})
|
|
63
54
|
})
|
|
64
55
|
|
|
65
|
-
describe('Persona
|
|
56
|
+
describe('Persona element', () => {
|
|
66
57
|
test('creates persona element with role', () => {
|
|
67
|
-
const node = jsx(
|
|
58
|
+
const node = jsx('persona', { role: 'security expert' })
|
|
68
59
|
expect(node.type).toBe('persona')
|
|
69
60
|
expect(node.props.role).toBe('security expert')
|
|
70
61
|
})
|
|
71
62
|
|
|
72
63
|
test('renders description children', () => {
|
|
73
|
-
const node = jsx(
|
|
64
|
+
const node = jsx('persona', { role: 'expert', children: 'You specialize in security.' })
|
|
74
65
|
expect(node.children).toHaveLength(1)
|
|
75
66
|
})
|
|
76
67
|
})
|
|
77
68
|
|
|
78
|
-
describe('Constraints
|
|
69
|
+
describe('Constraints element', () => {
|
|
79
70
|
test('creates constraints element', () => {
|
|
80
|
-
const node = jsx(
|
|
71
|
+
const node = jsx('constraints', { children: '- Be concise' })
|
|
81
72
|
expect(node.type).toBe('constraints')
|
|
82
73
|
})
|
|
83
74
|
})
|
|
84
75
|
|
|
85
|
-
describe('Task
|
|
76
|
+
describe('Task element', () => {
|
|
86
77
|
test('creates task element with done prop', () => {
|
|
87
|
-
const node = jsx(
|
|
78
|
+
const node = jsx('task', { done: false, children: 'Pending task' })
|
|
88
79
|
expect(node.type).toBe('task')
|
|
89
80
|
expect(node.props.done).toBe(false)
|
|
90
81
|
})
|
|
91
82
|
|
|
92
83
|
test('done prop can be true', () => {
|
|
93
|
-
const node = jsx(
|
|
84
|
+
const node = jsx('task', { done: true, children: 'Completed task' })
|
|
94
85
|
expect(node.props.done).toBe(true)
|
|
95
86
|
})
|
|
96
87
|
})
|
|
97
88
|
|
|
98
|
-
describe('Human
|
|
89
|
+
describe('Human element', () => {
|
|
99
90
|
test('creates human element with message', () => {
|
|
100
|
-
const node = jsx(
|
|
91
|
+
const node = jsx('human', { message: 'Approve?' })
|
|
101
92
|
expect(node.type).toBe('human')
|
|
102
93
|
expect(node.props.message).toBe('Approve?')
|
|
103
94
|
})
|
|
104
95
|
})
|
|
105
96
|
|
|
106
|
-
describe('Subagent
|
|
97
|
+
describe('Subagent element', () => {
|
|
107
98
|
test('creates subagent element with name', () => {
|
|
108
|
-
const node = jsx(
|
|
99
|
+
const node = jsx('subagent', { name: 'researcher' })
|
|
109
100
|
expect(node.type).toBe('subagent')
|
|
110
101
|
expect(node.props.name).toBe('researcher')
|
|
111
102
|
})
|
|
112
103
|
|
|
113
104
|
test('parallel prop is set', () => {
|
|
114
|
-
const node = jsx(
|
|
105
|
+
const node = jsx('subagent', { name: 'parallel-agent', parallel: true })
|
|
115
106
|
expect(node.props.parallel).toBe(true)
|
|
116
107
|
})
|
|
117
108
|
|
|
118
109
|
test('renders child components', () => {
|
|
119
|
-
const child = jsx(
|
|
120
|
-
const node = jsx(
|
|
110
|
+
const child = jsx('phase', { name: 'inner' })
|
|
111
|
+
const node = jsx('subagent', { name: 'outer', children: child })
|
|
121
112
|
expect(node.children).toHaveLength(1)
|
|
122
113
|
})
|
|
123
114
|
})
|
|
124
115
|
|
|
125
|
-
describe('
|
|
116
|
+
describe('Claude-api element', () => {
|
|
126
117
|
test('creates claude-api element', () => {
|
|
127
|
-
const node = jsx(
|
|
118
|
+
const node = jsx('claude-api', { children: 'Prompt text' })
|
|
128
119
|
expect(node.type).toBe('claude-api')
|
|
129
120
|
})
|
|
130
121
|
|
|
131
122
|
test('accepts model prop', () => {
|
|
132
|
-
const node = jsx(
|
|
123
|
+
const node = jsx('claude-api', { model: 'claude-opus-4' })
|
|
133
124
|
expect(node.props.model).toBe('claude-opus-4')
|
|
134
125
|
})
|
|
135
126
|
})
|
|
136
127
|
|
|
137
128
|
describe('Component composition', () => {
|
|
138
129
|
test('nested components create proper tree structure', () => {
|
|
139
|
-
const stepNode = jsx(
|
|
140
|
-
const phaseNode = jsx(
|
|
130
|
+
const stepNode = jsx('step', { children: 'Step 1' })
|
|
131
|
+
const phaseNode = jsx('phase', { name: 'test', children: stepNode })
|
|
141
132
|
|
|
142
133
|
expect(phaseNode.type).toBe('phase')
|
|
143
134
|
expect(phaseNode.children).toHaveLength(1)
|
|
@@ -145,8 +136,8 @@ describe('Component composition', () => {
|
|
|
145
136
|
})
|
|
146
137
|
|
|
147
138
|
test('serializes nested structure correctly', () => {
|
|
148
|
-
const stepNode = jsx(
|
|
149
|
-
const phaseNode = jsx(
|
|
139
|
+
const stepNode = jsx('step', { children: 'Do work' })
|
|
140
|
+
const phaseNode = jsx('phase', { name: 'main', children: stepNode })
|
|
150
141
|
|
|
151
142
|
const xml = serialize(phaseNode)
|
|
152
143
|
|