Skip to content

Commit d6bf76f

Browse files
committed
Fix hidden unit test errors
1 parent e6ecc4e commit d6bf76f

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
"onCommand:openshift.component.log",
6262
"onCommand:openshift.component.unlink",
6363
"onCommand:openshift.component.unlink.palette",
64-
"onCommand:openshift.component.unlink.service.palette",
64+
"onCommand:openshift.component.unlinkComponent.palette",
65+
"onCommand:openshift.component.unlinkService.palette",
6566
"onCommand:openshift.component.log.palette",
6667
"onCommand:openshift.component.followLog",
6768
"onCommand:openshift.component.followLog.palette",
@@ -277,12 +278,12 @@
277278
"category": "OpenShift"
278279
},
279280
{
280-
"command": "openshift.component.unlink.component.palette",
281+
"command": "openshift.component.unlinkComponent.palette",
281282
"title": "Unlink Component",
282283
"category": "OpenShift"
283284
},
284285
{
285-
"command": "openshift.component.unlink.service.palette",
286+
"command": "openshift.component.unlinkService.palette",
286287
"title": "Unlink Service",
287288
"category": "OpenShift"
288289
},

src/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ export async function activate(context: vscode.ExtensionContext) {
101101
vscode.commands.registerCommand('openshift.service.describe.palette', (context) => execute(Service.describe, context)),
102102
vscode.commands.registerCommand('openshift.component.linkComponent', (context) => execute(Component.linkComponent, context)),
103103
vscode.commands.registerCommand('openshift.component.unlink', (context) => execute(Component.unlink, context)),
104-
vscode.commands.registerCommand('openshift.component.unlink.component.palette', (context) => execute(Component.unlinkComponent, context)),
105-
vscode.commands.registerCommand('openshift.component.unlink.service.palette', (context) => execute(Component.unlinkService, context)),
104+
vscode.commands.registerCommand('openshift.component.unlinkComponent.palette', (context) => execute(Component.unlinkComponent, context)),
105+
vscode.commands.registerCommand('openshift.component.unlinkService.palette', (context) => execute(Component.unlinkService, context)),
106106
vscode.commands.registerCommand('openshift.component.linkService', (context) => execute(Component.linkService, context)),
107107
vscode.commands.registerCommand('openshift.explorer.reportIssue', () => OpenShiftExplorer.reportIssue()),
108108
vscode.commands.registerCommand('clusters.openshift.useProject', (context) => vscode.commands.executeCommand('extension.vsKubernetesUseNamespace', context)),

test/unit/extension.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,14 @@ suite('openshift connector Extension', async () => {
6767
assert.ok(vscode.extensions.getExtension('redhat.vscode-openshift-connector'));
6868
});
6969

70-
async function getStaticMethodsToStub(osc: string[]): Promise<string[]> {
70+
function getStaticMethodsToStub(osc: string[]): string[] {
7171
const mths: Set<string> = new Set();
7272
osc.forEach((name) => {
7373
name = name.replace('.palette', '');
7474
const segs: string[] = name.split('.');
7575
let methName: string = segs[segs.length-1];
7676
methName = methName === 'delete'? 'del' : methName;
7777
!mths.has(methName) && mths.add(methName);
78-
7978
});
8079
return [...mths];
8180
}
@@ -84,15 +83,17 @@ suite('openshift connector Extension', async () => {
8483
sandbox.stub(vscode.window, 'showErrorMessage');
8584
const cmds: string[] = await vscode.commands.getCommands();
8685
const osc: string[] = cmds.filter((item) => item.startsWith('openshift.'));
87-
const mths: string[] = await getStaticMethodsToStub(osc);
86+
const mths: string[] = getStaticMethodsToStub(osc);
8887
[Application, Catalog, Cluster, Component, Project, Service, Storage, Url, OpenShiftExplorer].forEach((item: { [x: string]: any; }) => {
8988
mths.forEach((name) => {
9089
if (item[name]) {
9190
sandbox.stub(item, name).resolves();
9291
}
9392
});
9493
});
95-
osc.forEach((item) => vscode.commands.executeCommand(item));
94+
for (const command of osc) {
95+
await vscode.commands.executeCommand(command);
96+
}
9697
expect(vscode.window.showErrorMessage).has.not.been.called;
9798
});
9899

0 commit comments

Comments
 (0)