Skip to content

Commit c0fd875

Browse files
committed
Move activation unit test to separate suite and add as the first test
Signed-off-by: Denis Golovin [email protected]
1 parent 5702c9d commit c0fd875

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

test/unit/activation.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*-----------------------------------------------------------------------------------------------
2+
* Copyright (c) Red Hat, Inc. All rights reserved.
3+
* Licensed under the MIT License. See LICENSE file in the project root for license information.
4+
*-----------------------------------------------------------------------------------------------*/
5+
/* eslint-disable no-console */
6+
import * as vscode from 'vscode';
7+
8+
suite('Extension activation', () => {
9+
test('Extension is activated', async () => {
10+
await vscode.commands.executeCommand('openshift.output');
11+
});
12+
});

test/unit/extension.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ suite('openshift toolkit Extension', () => {
5656
const appItem = new OpenShiftApplication(projectItem, 'app1');
5757
const fixtureFolder = path.join(__dirname, '..', '..', '..', 'test', 'fixtures').normalize();
5858
const comp2Uri = vscode.Uri.file(path.join(fixtureFolder, 'components', 'comp2'));
59-
let activated;
60-
setup(async () => {
59+
60+
setup(() => {
6161
sandbox = sinon.createSandbox();
6262
sandbox.stub(vscode.workspace, 'workspaceFolders').value([{
6363
uri: vscode.Uri.file(path.join(fixtureFolder, 'components', 'comp1')), index: 0, name: 'comp1'
@@ -87,10 +87,6 @@ suite('openshift toolkit Extension', () => {
8787
}
8888
return { error: undefined, stdout: '', stderr: ''};
8989
});
90-
if (!activated) {
91-
await vscode.commands.executeCommand('openshift.output');
92-
activated = true;
93-
}
9490
sandbox.stub(OdoImpl.prototype, '_getClusters').resolves([clusterItem]);
9591
sandbox.stub(OdoImpl.prototype, '_getProjects').resolves([projectItem]);
9692
sandbox.stub(OdoImpl.prototype, '_getApplications').resolves([appItem]);

test/unit/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const config: Mocha.MochaOptions = {
1818
timeout: 60000,
1919
color: true,
2020
// grep: 'loads components in workspace',
21+
require: ['./helper.js'],
2122
};
2223

2324
const mocha = new Mocha(config);
@@ -51,6 +52,9 @@ export async function run(): Promise<void> {
5152
const testFinder = createTestFinder(testsRoot);
5253
const testFiles:string[] = [];
5354

55+
// add activation test first
56+
testFiles.push(...await testFinder('activation.js'));
57+
// everything else after
5458
testFiles.push(...await testFinder('**/extension.test.js'));
5559
testFiles.push(...await testFinder('**/workspace.test.js'));
5660
testFiles.push(...await testFinder('k8s/*.test.js'));

0 commit comments

Comments
 (0)