Skip to content

Commit b781cf3

Browse files
committed
AXON-762: fix tests and status bug
1 parent 15d58e5 commit b781cf3

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

src/commands/jira/startWorkOnIssue.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,20 @@ import { FeatureFlagClient, Features } from '../../util/featureFlags';
88
export async function startWorkOnIssue(issueOrKeyAndSite: MinimalIssueOrKeyAndSite<DetailedSiteInfo>) {
99
let issue: MinimalIssue<DetailedSiteInfo>;
1010

11-
if (isMinimalIssue(issueOrKeyAndSite)) {
12-
issue = issueOrKeyAndSite;
13-
} else {
11+
if (FeatureFlagClient.checkGate(Features.StartWorkV3)) {
1412
issue = await fetchMinimalIssue(issueOrKeyAndSite.key, issueOrKeyAndSite.siteDetails);
15-
16-
if (!issue) {
17-
throw new Error(`Jira issue ${issueOrKeyAndSite.key} not found in site ${issueOrKeyAndSite.siteDetails}`);
13+
} else {
14+
if (isMinimalIssue(issueOrKeyAndSite)) {
15+
issue = issueOrKeyAndSite;
16+
} else {
17+
issue = await fetchMinimalIssue(issueOrKeyAndSite.key, issueOrKeyAndSite.siteDetails);
1818
}
1919
}
2020

21+
if (!issue) {
22+
throw new Error(`Jira issue ${issueOrKeyAndSite.key} not found in site ${issueOrKeyAndSite.siteDetails}`);
23+
}
24+
2125
const { startWorkV3WebviewFactory, startWorkWebviewFactory } = Container;
2226

2327
const factory = FeatureFlagClient.checkGate(Features.StartWorkV3)

src/react/atlascode/startwork/v3/StartWorkPageV3.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,6 @@ const StartWorkPageV3: React.FunctionComponent = () => {
101101
setSubmitState('submitting');
102102

103103
try {
104-
console.log('Form data:', {
105-
transitionIssueEnabled,
106-
selectedTransition,
107-
branchSetupEnabled,
108-
pushBranchEnabled,
109-
localBranch,
110-
sourceBranch,
111-
selectedRepository,
112-
selectedBranchType,
113-
upstream,
114-
});
115-
116-
// TODO: Replace with actual API call
117104
if (!selectedRepository) {
118105
throw new Error('No repository selected');
119106
}
@@ -149,7 +136,6 @@ const StartWorkPageV3: React.FunctionComponent = () => {
149136
localBranch,
150137
sourceBranch,
151138
selectedRepository,
152-
selectedBranchType,
153139
upstream,
154140
]);
155141

src/webview/startwork/vscStartWorkActionApi.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,22 @@ import { Container } from '../../container';
77
import { ConfigSection, ConfigSubSection } from '../../lib/ipc/models/config';
88
import { Logger } from '../../logger';
99
import { Branch, RefType } from '../../typings/git';
10+
import { FeatureFlagClient } from '../../util/featureFlags';
1011
import { VSCStartWorkActionApi } from './vscStartWorkActionApi';
1112

1213
// Mock external dependencies
1314
jest.mock('../../logger');
1415
jest.mock('../../bitbucket/bbUtils');
1516
jest.mock('../../container');
17+
jest.mock('../../util/featureFlags', () => ({
18+
FeatureFlagClient: {
19+
checkGate: jest.fn(),
20+
checkExperimentValue: jest.fn(),
21+
},
22+
Features: {
23+
StartWorkV3: 'startWorkV3',
24+
},
25+
}));
1626

1727
describe('VSCStartWorkActionApi', () => {
1828
let api: VSCStartWorkActionApi;
@@ -174,6 +184,8 @@ describe('VSCStartWorkActionApi', () => {
174184
// Mock clientForSite
175185
(clientForSite as jest.Mock).mockResolvedValue(mockBbClient);
176186

187+
(FeatureFlagClient.checkGate as jest.Mock).mockReturnValue(false);
188+
177189
api = new VSCStartWorkActionApi();
178190
});
179191

0 commit comments

Comments
 (0)