clawt 3.1.1 → 3.1.3

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.
@@ -49,6 +49,7 @@ import {
49
49
  saveProjectConfig,
50
50
  requireProjectConfig,
51
51
  getMainWorkBranch,
52
+ getValidateRunCommand,
52
53
  } from '../../../src/utils/project-config.js';
53
54
 
54
55
  const mockedExistsSync = vi.mocked(existsSync);
@@ -134,3 +135,34 @@ describe('getMainWorkBranch', () => {
134
135
  expect(getMainWorkBranch()).toBe('develop');
135
136
  });
136
137
  });
138
+
139
+ describe('getValidateRunCommand', () => {
140
+ it('配置中有 validateRunCommand 时返回对应值', () => {
141
+ mockedExistsSync.mockReturnValue(true);
142
+ mockedReadFileSync.mockReturnValue(JSON.stringify({
143
+ clawtMainWorkBranch: 'main',
144
+ validateRunCommand: 'npm test',
145
+ }));
146
+ expect(getValidateRunCommand()).toBe('npm test');
147
+ });
148
+
149
+ it('配置中无 validateRunCommand 时返回 undefined', () => {
150
+ mockedExistsSync.mockReturnValue(true);
151
+ mockedReadFileSync.mockReturnValue(JSON.stringify({ clawtMainWorkBranch: 'main' }));
152
+ expect(getValidateRunCommand()).toBeUndefined();
153
+ });
154
+
155
+ it('配置文件不存在时返回 undefined', () => {
156
+ mockedExistsSync.mockReturnValue(false);
157
+ expect(getValidateRunCommand()).toBeUndefined();
158
+ });
159
+
160
+ it('validateRunCommand 为空字符串时返回 undefined', () => {
161
+ mockedExistsSync.mockReturnValue(true);
162
+ mockedReadFileSync.mockReturnValue(JSON.stringify({
163
+ clawtMainWorkBranch: 'main',
164
+ validateRunCommand: '',
165
+ }));
166
+ expect(getValidateRunCommand()).toBeUndefined();
167
+ });
168
+ });