github-issue-tower-defence-management 1.45.0 → 1.47.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/CHANGELOG.md +20 -0
- package/README.md +64 -0
- package/bin/adapter/entry-points/cli/index.js +0 -52
- package/bin/adapter/entry-points/cli/index.js.map +1 -1
- package/bin/adapter/entry-points/handlers/GetStoryObjectMapUseCaseHandler.js +0 -2
- package/bin/adapter/entry-points/handlers/GetStoryObjectMapUseCaseHandler.js.map +1 -1
- package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js +20 -15
- package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js.map +1 -1
- package/bin/adapter/entry-points/handlers/situationFileWriter.js +98 -0
- package/bin/adapter/entry-points/handlers/situationFileWriter.js.map +1 -0
- package/bin/adapter/repositories/BaseGitHubRepository.js +5 -22
- package/bin/adapter/repositories/BaseGitHubRepository.js.map +1 -1
- package/bin/adapter/repositories/GraphqlProjectRepository.js +40 -0
- package/bin/adapter/repositories/GraphqlProjectRepository.js.map +1 -1
- package/package.json +1 -2
- package/src/adapter/entry-points/cli/index.test.ts +0 -49
- package/src/adapter/entry-points/cli/index.ts +2 -21
- package/src/adapter/entry-points/handlers/GetStoryObjectMapUseCaseHandler.test.ts +0 -6
- package/src/adapter/entry-points/handlers/GetStoryObjectMapUseCaseHandler.ts +0 -2
- package/src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.test.ts +23 -51
- package/src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.ts +27 -18
- package/src/adapter/entry-points/handlers/situationFileWriter.test.ts +417 -0
- package/src/adapter/entry-points/handlers/situationFileWriter.ts +168 -0
- package/src/adapter/repositories/BaseGitHubRepository.test.ts +3 -48
- package/src/adapter/repositories/BaseGitHubRepository.ts +5 -33
- package/src/adapter/repositories/GraphqlProjectRepository.test.ts +72 -0
- package/src/adapter/repositories/GraphqlProjectRepository.ts +57 -1
- package/types/adapter/entry-points/cli/index.d.ts.map +1 -1
- package/types/adapter/entry-points/handlers/GetStoryObjectMapUseCaseHandler.d.ts.map +1 -1
- package/types/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.d.ts.map +1 -1
- package/types/adapter/entry-points/handlers/situationFileWriter.d.ts +30 -0
- package/types/adapter/entry-points/handlers/situationFileWriter.d.ts.map +1 -0
- package/types/adapter/repositories/BaseGitHubRepository.d.ts +0 -1
- package/types/adapter/repositories/BaseGitHubRepository.d.ts.map +1 -1
- package/types/adapter/repositories/GraphqlProjectRepository.d.ts +5 -2
- package/types/adapter/repositories/GraphqlProjectRepository.d.ts.map +1 -1
- package/bin/adapter/repositories/CheerioProjectRepository.js +0 -45
- package/bin/adapter/repositories/CheerioProjectRepository.js.map +0 -1
- package/src/adapter/repositories/CheerioProjectRepository.test.ts +0 -122
- package/src/adapter/repositories/CheerioProjectRepository.ts +0 -65
- package/types/adapter/repositories/CheerioProjectRepository.d.ts +0 -17
- package/types/adapter/repositories/CheerioProjectRepository.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphqlProjectRepository.js","sourceRoot":"","sources":["../../../src/adapter/repositories/GraphqlProjectRepository.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,iEAA8D;AAG9D,mCAA6C;AAE7C,MAAa,wBACX,SAAQ,2CAAoB;IAD9B;;
|
|
1
|
+
{"version":3,"file":"GraphqlProjectRepository.js","sourceRoot":"","sources":["../../../src/adapter/repositories/GraphqlProjectRepository.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,iEAA8D;AAG9D,mCAA6C;AAE7C,MAAa,wBACX,SAAQ,2CAAoB;IAD9B;;QAQE,0BAAqB,GAAG,CACtB,UAAkB,EAIlB,EAAE;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;YAChC,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK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CAAC,KAAK,CAAC,OAAO;gBAC9B,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;oBAC/D,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC9B,IAAI;oBACJ,KAAK;oBACL,WAAW;iBACZ,CAAC,CAAC;aACJ,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,YAAE;iBACtB,IAAI,CAAC,gCAAgC,EAAE;gBACtC,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE;gBACpC,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,CAAC,OAAO,EAAE;iBACxC;aACF,CAAC;iBACD,IAAI,EAQD,CAAC;YACP,OAAO,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,OAAO,CAAC;QACnE,CAAC,CAAC;IACJ,CAAC;CAAA;AAtWD,4DAsWC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-issue-tower-defence-management",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -76,7 +76,6 @@
|
|
|
76
76
|
"commander": "^14.0.0",
|
|
77
77
|
"cookie": "^1.0.1",
|
|
78
78
|
"dotenv": "^17.0.0",
|
|
79
|
-
"gh-cookie": "^1.3.22",
|
|
80
79
|
"googleapis": "^171.0.0",
|
|
81
80
|
"ky": "^2.0.0",
|
|
82
81
|
"typia": "^12.0.0",
|
|
@@ -24,9 +24,6 @@ jest.mock('../../repositories/GraphqlProjectRepository', () => ({
|
|
|
24
24
|
findProjectIdByUrl: jest.fn().mockResolvedValue('PVT_kwHOtest456'),
|
|
25
25
|
})),
|
|
26
26
|
}));
|
|
27
|
-
jest.mock('../../repositories/CheerioProjectRepository', () => ({
|
|
28
|
-
CheerioProjectRepository: jest.fn().mockImplementation(() => ({})),
|
|
29
|
-
}));
|
|
30
27
|
jest.mock('../../repositories/issue/ApiV3IssueRepository', () => ({
|
|
31
28
|
ApiV3IssueRepository: jest.fn().mockImplementation(() => ({})),
|
|
32
29
|
}));
|
|
@@ -1071,52 +1068,6 @@ codexHomeCandidates:
|
|
|
1071
1068
|
}),
|
|
1072
1069
|
);
|
|
1073
1070
|
});
|
|
1074
|
-
|
|
1075
|
-
it('should write runtimeConfig-{projectId}.json atomically after useCase run', async () => {
|
|
1076
|
-
const configWithNumericValues = {
|
|
1077
|
-
...defaultConfig,
|
|
1078
|
-
maximumPreparingIssuesCount: 10,
|
|
1079
|
-
utilizationPercentageThreshold: 97,
|
|
1080
|
-
allowIssueCacheMinutes: 5,
|
|
1081
|
-
thresholdForAutoReject: 30,
|
|
1082
|
-
};
|
|
1083
|
-
writeConfig(configWithNumericValues);
|
|
1084
|
-
|
|
1085
|
-
const mockRun = jest.fn().mockResolvedValue(undefined);
|
|
1086
|
-
const MockedStartPreparationUseCase = jest.mocked(
|
|
1087
|
-
StartPreparationUseCase,
|
|
1088
|
-
);
|
|
1089
|
-
MockedStartPreparationUseCase.mockImplementation(function (
|
|
1090
|
-
this: StartPreparationUseCase,
|
|
1091
|
-
) {
|
|
1092
|
-
this.run = mockRun;
|
|
1093
|
-
return this;
|
|
1094
|
-
});
|
|
1095
|
-
|
|
1096
|
-
await program.parseAsync([
|
|
1097
|
-
'node',
|
|
1098
|
-
'test',
|
|
1099
|
-
'startDaemon',
|
|
1100
|
-
'--configFilePath',
|
|
1101
|
-
configFilePath,
|
|
1102
|
-
]);
|
|
1103
|
-
|
|
1104
|
-
const cacheDir = path.join(process.cwd(), 'tmp/cache/test-project');
|
|
1105
|
-
const runtimeConfigPath = path.join(
|
|
1106
|
-
cacheDir,
|
|
1107
|
-
'runtimeConfig-PVT_kwHOtest456.json',
|
|
1108
|
-
);
|
|
1109
|
-
expect(fs.existsSync(runtimeConfigPath)).toBe(true);
|
|
1110
|
-
const written: unknown = JSON.parse(
|
|
1111
|
-
fs.readFileSync(runtimeConfigPath, 'utf-8'),
|
|
1112
|
-
);
|
|
1113
|
-
expect(written).toMatchObject({
|
|
1114
|
-
maximumPreparingIssuesCount: 10,
|
|
1115
|
-
utilizationPercentageThreshold: 97,
|
|
1116
|
-
allowIssueCacheMinutes: 5,
|
|
1117
|
-
thresholdForAutoReject: 30,
|
|
1118
|
-
});
|
|
1119
|
-
});
|
|
1120
1071
|
});
|
|
1121
1072
|
|
|
1122
1073
|
describe('notifyFinishedIssuePreparation', () => {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import * as fs from 'fs';
|
|
3
2
|
import { Command } from 'commander';
|
|
4
3
|
import { HandleScheduledEventUseCaseHandler } from '../handlers/HandleScheduledEventUseCaseHandler';
|
|
5
4
|
export {
|
|
@@ -25,7 +24,6 @@ import { RestIssueRepository } from '../../repositories/issue/RestIssueRepositor
|
|
|
25
24
|
import { GraphqlProjectItemRepository } from '../../repositories/issue/GraphqlProjectItemRepository';
|
|
26
25
|
import { ApiV3CheerioRestIssueRepository } from '../../repositories/issue/ApiV3CheerioRestIssueRepository';
|
|
27
26
|
import { LocalStorageCacheRepository } from '../../repositories/LocalStorageCacheRepository';
|
|
28
|
-
import { CheerioProjectRepository } from '../../repositories/CheerioProjectRepository';
|
|
29
27
|
import { BaseGitHubRepository } from '../../repositories/BaseGitHubRepository';
|
|
30
28
|
import { NodeLocalCommandRunner } from '../../repositories/NodeLocalCommandRunner';
|
|
31
29
|
import { OauthAPIProxyClaudeRepository } from '../../repositories/OauthAPIProxyClaudeRepository';
|
|
@@ -257,7 +255,7 @@ program
|
|
|
257
255
|
);
|
|
258
256
|
const projectRepository = {
|
|
259
257
|
...new GraphqlProjectRepository(...githubRepositoryParams),
|
|
260
|
-
|
|
258
|
+
|
|
261
259
|
prepareStatus: async (
|
|
262
260
|
_name: string,
|
|
263
261
|
project: Project,
|
|
@@ -343,23 +341,6 @@ program
|
|
|
343
341
|
codexHomeCandidates,
|
|
344
342
|
allowIssueCacheMinutes,
|
|
345
343
|
});
|
|
346
|
-
|
|
347
|
-
const projectId = await projectRepository.findProjectIdByUrl(projectUrl);
|
|
348
|
-
if (projectId) {
|
|
349
|
-
const runtimeConfig = {
|
|
350
|
-
resolvedAt: new Date().toISOString(),
|
|
351
|
-
maximumPreparingIssuesCount: maximumPreparingIssuesCount,
|
|
352
|
-
utilizationPercentageThreshold:
|
|
353
|
-
config.utilizationPercentageThreshold ?? 90,
|
|
354
|
-
allowIssueCacheMinutes: allowIssueCacheMinutes,
|
|
355
|
-
thresholdForAutoReject: config.thresholdForAutoReject ?? 3,
|
|
356
|
-
};
|
|
357
|
-
const finalPath = `${cachePath}/runtimeConfig-${projectId}.json`;
|
|
358
|
-
const tmpPath = `${finalPath}.tmp`;
|
|
359
|
-
fs.mkdirSync(cachePath, { recursive: true });
|
|
360
|
-
fs.writeFileSync(tmpPath, JSON.stringify(runtimeConfig));
|
|
361
|
-
fs.renameSync(tmpPath, finalPath);
|
|
362
|
-
}
|
|
363
344
|
});
|
|
364
345
|
|
|
365
346
|
program
|
|
@@ -490,7 +471,7 @@ program
|
|
|
490
471
|
);
|
|
491
472
|
const projectRepository = {
|
|
492
473
|
...new GraphqlProjectRepository(...githubRepositoryParams),
|
|
493
|
-
|
|
474
|
+
|
|
494
475
|
prepareStatus: async (
|
|
495
476
|
_name: string,
|
|
496
477
|
project: Project,
|
|
@@ -2,7 +2,6 @@ import fs from 'fs';
|
|
|
2
2
|
import YAML from 'yaml';
|
|
3
3
|
|
|
4
4
|
jest.mock('fs');
|
|
5
|
-
jest.mock('gh-cookie', () => ({ getCookieContent: jest.fn() }));
|
|
6
5
|
jest.mock('../../repositories/LocalStorageRepository');
|
|
7
6
|
jest.mock('../../repositories/GraphqlProjectRepository');
|
|
8
7
|
jest.mock('../../repositories/issue/ApiV3IssueRepository');
|
|
@@ -11,7 +10,6 @@ jest.mock('../../repositories/issue/GraphqlProjectItemRepository');
|
|
|
11
10
|
jest.mock('../../repositories/issue/ApiV3CheerioRestIssueRepository');
|
|
12
11
|
jest.mock('../../repositories/LocalStorageCacheRepository');
|
|
13
12
|
jest.mock('../../repositories/BaseGitHubRepository');
|
|
14
|
-
jest.mock('../../repositories/CheerioProjectRepository');
|
|
15
13
|
|
|
16
14
|
const mockRun = jest.fn().mockResolvedValue({
|
|
17
15
|
project: {},
|
|
@@ -28,14 +26,12 @@ jest.mock('../../../domain/usecases/GetStoryObjectMapUseCase', () => ({
|
|
|
28
26
|
|
|
29
27
|
import { GetStoryObjectMapUseCaseHandler } from './GetStoryObjectMapUseCaseHandler';
|
|
30
28
|
import { GraphqlProjectRepository } from '../../repositories/GraphqlProjectRepository';
|
|
31
|
-
import { CheerioProjectRepository } from '../../repositories/CheerioProjectRepository';
|
|
32
29
|
import { ApiV3IssueRepository } from '../../repositories/issue/ApiV3IssueRepository';
|
|
33
30
|
import { RestIssueRepository } from '../../repositories/issue/RestIssueRepository';
|
|
34
31
|
import { GraphqlProjectItemRepository } from '../../repositories/issue/GraphqlProjectItemRepository';
|
|
35
32
|
import { ApiV3CheerioRestIssueRepository } from '../../repositories/issue/ApiV3CheerioRestIssueRepository';
|
|
36
33
|
|
|
37
34
|
const MockedGraphqlProjectRepository = jest.mocked(GraphqlProjectRepository);
|
|
38
|
-
const MockedCheerioProjectRepository = jest.mocked(CheerioProjectRepository);
|
|
39
35
|
const MockedApiV3IssueRepository = jest.mocked(ApiV3IssueRepository);
|
|
40
36
|
const MockedRestIssueRepository = jest.mocked(RestIssueRepository);
|
|
41
37
|
const MockedGraphqlProjectItemRepository = jest.mocked(
|
|
@@ -122,7 +118,6 @@ describe('GetStoryObjectMapUseCaseHandler', () => {
|
|
|
122
118
|
|
|
123
119
|
for (const MockedClass of [
|
|
124
120
|
MockedGraphqlProjectRepository,
|
|
125
|
-
MockedCheerioProjectRepository,
|
|
126
121
|
MockedApiV3IssueRepository,
|
|
127
122
|
MockedRestIssueRepository,
|
|
128
123
|
MockedGraphqlProjectItemRepository,
|
|
@@ -159,7 +154,6 @@ describe('GetStoryObjectMapUseCaseHandler', () => {
|
|
|
159
154
|
|
|
160
155
|
for (const MockedClass of [
|
|
161
156
|
MockedGraphqlProjectRepository,
|
|
162
|
-
MockedCheerioProjectRepository,
|
|
163
157
|
MockedApiV3IssueRepository,
|
|
164
158
|
MockedRestIssueRepository,
|
|
165
159
|
MockedGraphqlProjectItemRepository,
|
|
@@ -11,7 +11,6 @@ import { LocalStorageCacheRepository } from '../../repositories/LocalStorageCach
|
|
|
11
11
|
import { Issue } from '../../../domain/entities/Issue';
|
|
12
12
|
import { Project } from '../../../domain/entities/Project';
|
|
13
13
|
import { BaseGitHubRepository } from '../../repositories/BaseGitHubRepository';
|
|
14
|
-
import { CheerioProjectRepository } from '../../repositories/CheerioProjectRepository';
|
|
15
14
|
import { GetStoryObjectMapUseCase } from '../../../domain/usecases/GetStoryObjectMapUseCase';
|
|
16
15
|
import { StoryObjectMap } from '../../../domain/entities/StoryObjectMap';
|
|
17
16
|
|
|
@@ -65,7 +64,6 @@ export class GetStoryObjectMapUseCaseHandler {
|
|
|
65
64
|
];
|
|
66
65
|
const projectRepository = {
|
|
67
66
|
...new GraphqlProjectRepository(...githubRepositoryParams),
|
|
68
|
-
...new CheerioProjectRepository(...githubRepositoryParams),
|
|
69
67
|
};
|
|
70
68
|
const apiV3IssueRepository = new ApiV3IssueRepository(
|
|
71
69
|
...githubRepositoryParams,
|
|
@@ -3,12 +3,10 @@ import YAML from 'yaml';
|
|
|
3
3
|
import type { HandleScheduledEventUseCase } from '../../../domain/usecases/HandleScheduledEventUseCase';
|
|
4
4
|
|
|
5
5
|
jest.mock('fs');
|
|
6
|
-
jest.mock('gh-cookie', () => ({ getCookieContent: jest.fn() }));
|
|
7
6
|
jest.mock('../../repositories/SystemDateRepository');
|
|
8
7
|
jest.mock('../../repositories/LocalStorageRepository');
|
|
9
8
|
jest.mock('../../repositories/GoogleSpreadsheetRepository');
|
|
10
9
|
jest.mock('../../repositories/GraphqlProjectRepository');
|
|
11
|
-
jest.mock('../../repositories/CheerioProjectRepository');
|
|
12
10
|
jest.mock('../../repositories/issue/ApiV3IssueRepository');
|
|
13
11
|
jest.mock('../../repositories/issue/RestIssueRepository');
|
|
14
12
|
jest.mock('../../repositories/issue/GraphqlProjectItemRepository');
|
|
@@ -115,17 +113,19 @@ jest.mock('../../repositories/GitHubIssueCommentRepository', () => ({
|
|
|
115
113
|
jest.mock('../../repositories/FetchWebhookRepository', () => ({
|
|
116
114
|
FetchWebhookRepository: jest.fn().mockImplementation(() => ({})),
|
|
117
115
|
}));
|
|
116
|
+
jest.mock('./situationFileWriter', () => ({
|
|
117
|
+
writeSituationFile: jest.fn().mockResolvedValue(undefined),
|
|
118
|
+
}));
|
|
118
119
|
|
|
119
120
|
import { HandleScheduledEventUseCaseHandler } from './HandleScheduledEventUseCaseHandler';
|
|
121
|
+
import { writeSituationFile } from './situationFileWriter';
|
|
120
122
|
import { GraphqlProjectRepository } from '../../repositories/GraphqlProjectRepository';
|
|
121
|
-
import { CheerioProjectRepository } from '../../repositories/CheerioProjectRepository';
|
|
122
123
|
import { ApiV3IssueRepository } from '../../repositories/issue/ApiV3IssueRepository';
|
|
123
124
|
import { RestIssueRepository } from '../../repositories/issue/RestIssueRepository';
|
|
124
125
|
import { GraphqlProjectItemRepository } from '../../repositories/issue/GraphqlProjectItemRepository';
|
|
125
126
|
import { ApiV3CheerioRestIssueRepository } from '../../repositories/issue/ApiV3CheerioRestIssueRepository';
|
|
126
127
|
|
|
127
128
|
const MockedGraphqlProjectRepository = jest.mocked(GraphqlProjectRepository);
|
|
128
|
-
const MockedCheerioProjectRepository = jest.mocked(CheerioProjectRepository);
|
|
129
129
|
const MockedApiV3IssueRepository = jest.mocked(ApiV3IssueRepository);
|
|
130
130
|
const MockedRestIssueRepository = jest.mocked(RestIssueRepository);
|
|
131
131
|
const MockedGraphqlProjectItemRepository = jest.mocked(
|
|
@@ -211,7 +211,6 @@ describe('HandleScheduledEventUseCaseHandler', () => {
|
|
|
211
211
|
|
|
212
212
|
for (const MockedClass of [
|
|
213
213
|
MockedGraphqlProjectRepository,
|
|
214
|
-
MockedCheerioProjectRepository,
|
|
215
214
|
MockedApiV3IssueRepository,
|
|
216
215
|
MockedRestIssueRepository,
|
|
217
216
|
MockedGraphqlProjectItemRepository,
|
|
@@ -248,7 +247,6 @@ describe('HandleScheduledEventUseCaseHandler', () => {
|
|
|
248
247
|
|
|
249
248
|
for (const MockedClass of [
|
|
250
249
|
MockedGraphqlProjectRepository,
|
|
251
|
-
MockedCheerioProjectRepository,
|
|
252
250
|
MockedApiV3IssueRepository,
|
|
253
251
|
MockedRestIssueRepository,
|
|
254
252
|
MockedGraphqlProjectItemRepository,
|
|
@@ -264,7 +262,7 @@ describe('HandleScheduledEventUseCaseHandler', () => {
|
|
|
264
262
|
}
|
|
265
263
|
});
|
|
266
264
|
|
|
267
|
-
it('should write
|
|
265
|
+
it('should write situation file after successful run with resolved config values', async () => {
|
|
268
266
|
const configWithPreparation = {
|
|
269
267
|
...validConfig,
|
|
270
268
|
allowIssueCacheMinutes: 5,
|
|
@@ -292,64 +290,38 @@ describe('HandleScheduledEventUseCaseHandler', () => {
|
|
|
292
290
|
await handler.handle('config.yml', false);
|
|
293
291
|
|
|
294
292
|
const expectedCachePath = `./tmp/cache/${validConfig.projectName}`;
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
expect(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
expect(
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
);
|
|
305
|
-
expect(jest.mocked(fs.writeFileSync)).toHaveBeenCalledWith(
|
|
306
|
-
expectedTmpPath,
|
|
307
|
-
expect.stringContaining('"utilizationPercentageThreshold":97'),
|
|
308
|
-
);
|
|
309
|
-
expect(jest.mocked(fs.writeFileSync)).toHaveBeenCalledWith(
|
|
310
|
-
expectedTmpPath,
|
|
311
|
-
expect.stringContaining('"allowIssueCacheMinutes":5'),
|
|
312
|
-
);
|
|
313
|
-
expect(jest.mocked(fs.writeFileSync)).toHaveBeenCalledWith(
|
|
314
|
-
expectedTmpPath,
|
|
315
|
-
expect.stringContaining('"thresholdForAutoReject":30'),
|
|
316
|
-
);
|
|
317
|
-
expect(jest.mocked(fs.renameSync)).toHaveBeenCalledWith(
|
|
318
|
-
expectedTmpPath,
|
|
319
|
-
expectedFinalPath,
|
|
293
|
+
const firstCallArg = jest.mocked(writeSituationFile).mock.calls[0][0];
|
|
294
|
+
expect(firstCallArg.cachePath).toBe(expectedCachePath);
|
|
295
|
+
expect(firstCallArg.projectId).toBe('PVT_kwHOtest123');
|
|
296
|
+
expect(firstCallArg.config.maximumPreparingIssuesCount).toBe(10);
|
|
297
|
+
expect(firstCallArg.config.utilizationPercentageThreshold).toBe(97);
|
|
298
|
+
expect(firstCallArg.config.allowIssueCacheMinutes).toBe(5);
|
|
299
|
+
expect(firstCallArg.config.thresholdForAutoReject).toBe(30);
|
|
300
|
+
expect(firstCallArg.statusNames.awaitingQualityCheckStatus).toBe(
|
|
301
|
+
'Awaiting QC',
|
|
320
302
|
);
|
|
303
|
+
expect(firstCallArg.statusNames.preparationStatus).toBe('Preparing');
|
|
304
|
+
expect(firstCallArg.statusNames.awaitingWorkspaceStatus).toBe('Awaiting');
|
|
321
305
|
});
|
|
322
306
|
|
|
323
|
-
it('should write
|
|
307
|
+
it('should write situation file with numeric defaults when optional fields are absent', async () => {
|
|
324
308
|
const handler = new HandleScheduledEventUseCaseHandler();
|
|
325
309
|
await handler.handle('config.yml', false);
|
|
326
310
|
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
expect(
|
|
331
|
-
expectedTmpPath,
|
|
332
|
-
expect.stringContaining('"utilizationPercentageThreshold":90'),
|
|
333
|
-
);
|
|
334
|
-
expect(jest.mocked(fs.writeFileSync)).toHaveBeenCalledWith(
|
|
335
|
-
expectedTmpPath,
|
|
336
|
-
expect.stringContaining('"thresholdForAutoReject":3'),
|
|
337
|
-
);
|
|
338
|
-
expect(jest.mocked(fs.writeFileSync)).toHaveBeenCalledWith(
|
|
339
|
-
expectedTmpPath,
|
|
340
|
-
expect.stringContaining('"maximumPreparingIssuesCount":null'),
|
|
341
|
-
);
|
|
311
|
+
const firstCallArg = jest.mocked(writeSituationFile).mock.calls[0][0];
|
|
312
|
+
expect(firstCallArg.config.utilizationPercentageThreshold).toBe(90);
|
|
313
|
+
expect(firstCallArg.config.thresholdForAutoReject).toBe(3);
|
|
314
|
+
expect(firstCallArg.config.maximumPreparingIssuesCount).toBeNull();
|
|
342
315
|
});
|
|
343
316
|
|
|
344
|
-
it('should not write
|
|
317
|
+
it('should not write situation file when run returns null', async () => {
|
|
345
318
|
mockRun.mockResolvedValueOnce(null);
|
|
346
319
|
jest.mocked(fs.readFileSync).mockReturnValue(YAML.stringify(validConfig));
|
|
347
320
|
|
|
348
321
|
const handler = new HandleScheduledEventUseCaseHandler();
|
|
349
322
|
await handler.handle('config.yml', false);
|
|
350
323
|
|
|
351
|
-
expect(jest.mocked(
|
|
352
|
-
expect(jest.mocked(fs.renameSync)).not.toHaveBeenCalled();
|
|
324
|
+
expect(jest.mocked(writeSituationFile)).not.toHaveBeenCalled();
|
|
353
325
|
});
|
|
354
326
|
|
|
355
327
|
describe('README config overrides', () => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import YAML from 'yaml';
|
|
2
2
|
import TYPIA from 'typia';
|
|
3
3
|
import fs from 'fs';
|
|
4
|
+
import { writeSituationFile } from './situationFileWriter';
|
|
4
5
|
import {
|
|
5
6
|
fetchProjectReadme,
|
|
6
7
|
parseProjectReadmeConfig,
|
|
@@ -29,7 +30,6 @@ import { ConvertCheckboxToIssueInStoryIssueUseCase } from '../../../domain/useca
|
|
|
29
30
|
import { ChangeStatusByStoryColorUseCase } from '../../../domain/usecases/ChangeStatusByStoryColorUseCase';
|
|
30
31
|
import { SetNoStoryIssueToStoryUseCase } from '../../../domain/usecases/SetNoStoryIssueToStoryUseCase';
|
|
31
32
|
import { CreateNewStoryByLabelUseCase } from '../../../domain/usecases/CreateNewStoryByLabelUseCase';
|
|
32
|
-
import { CheerioProjectRepository } from '../../repositories/CheerioProjectRepository';
|
|
33
33
|
import { ProjectRepository } from '../../../domain/usecases/adapter-interfaces/ProjectRepository';
|
|
34
34
|
import { AssignNoAssigneeIssueToManagerUseCase } from '../../../domain/usecases/AssignNoAssigneeIssueToManagerUseCase';
|
|
35
35
|
import { UpdateIssueStatusByLabelUseCase } from '../../../domain/usecases/UpdateIssueStatusByLabelUseCase';
|
|
@@ -177,7 +177,6 @@ export class HandleScheduledEventUseCaseHandler {
|
|
|
177
177
|
];
|
|
178
178
|
const projectRepository: ProjectRepository = {
|
|
179
179
|
...new GraphqlProjectRepository(...githubRepositoryParams),
|
|
180
|
-
...new CheerioProjectRepository(...githubRepositoryParams),
|
|
181
180
|
prepareStatus: async (
|
|
182
181
|
_name: string,
|
|
183
182
|
project: Project,
|
|
@@ -293,22 +292,32 @@ export class HandleScheduledEventUseCaseHandler {
|
|
|
293
292
|
|
|
294
293
|
const result = await handleScheduledEventUseCase.run(mergedInput);
|
|
295
294
|
if (result) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
295
|
+
await writeSituationFile({
|
|
296
|
+
cachePath,
|
|
297
|
+
projectId: result.project.id,
|
|
298
|
+
issues: result.issues,
|
|
299
|
+
statusNames: {
|
|
300
|
+
awaitingQualityCheckStatus:
|
|
301
|
+
mergedInput.notifyFinishedPreparation?.awaitingQualityCheckStatus ??
|
|
302
|
+
null,
|
|
303
|
+
preparationStatus:
|
|
304
|
+
mergedInput.startPreparation?.preparationStatus ?? null,
|
|
305
|
+
awaitingWorkspaceStatus:
|
|
306
|
+
mergedInput.startPreparation?.awaitingWorkspaceStatus ?? null,
|
|
307
|
+
},
|
|
308
|
+
config: {
|
|
309
|
+
maximumPreparingIssuesCount:
|
|
310
|
+
mergedInput.startPreparation?.maximumPreparingIssuesCount ?? null,
|
|
311
|
+
utilizationPercentageThreshold:
|
|
312
|
+
mergedInput.startPreparation?.utilizationPercentageThreshold ?? 90,
|
|
313
|
+
allowIssueCacheMinutes: mergedInput.allowIssueCacheMinutes,
|
|
314
|
+
thresholdForAutoReject:
|
|
315
|
+
mergedInput.notifyFinishedPreparation?.thresholdForAutoReject ?? 3,
|
|
316
|
+
},
|
|
317
|
+
preparationProcessCheckCommand:
|
|
318
|
+
mergedInput.startPreparation?.preparationProcessCheckCommand ?? null,
|
|
319
|
+
localCommandRunner: nodeLocalCommandRunner,
|
|
320
|
+
});
|
|
312
321
|
}
|
|
313
322
|
return result;
|
|
314
323
|
};
|