Skip to content

Commit 6e03edf

Browse files
committed
clean up
1 parent ab5e8a3 commit 6e03edf

File tree

2 files changed

+40
-35
lines changed

2 files changed

+40
-35
lines changed

test/unitTests/logging/InformationMessageObserver.test.ts

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -37,42 +37,47 @@ suite("InformationMessageObserver", () => {
3737
});
3838
});
3939

40-
suite('OmnisharpServerUnresolvedDependencies', () => {
41-
let event = getUnresolvedDependenices("someFile");
42-
43-
suite('Suppress Dotnet Restore Notification is true', () => {
44-
setup(() => updateConfig(vscode, 'csharp', 'suppressDotnetRestoreNotification', true));
45-
46-
test('The information message is not shown', () => {
47-
observer.post(event);
48-
expect(infoMessage).to.be.undefined;
49-
});
50-
});
51-
52-
suite('Suppress Dotnet Restore Notification is false', () => {
53-
setup(() => updateConfig(vscode, 'csharp', 'suppressDotnetRestoreNotification', false));
54-
55-
test('The information message is shown', async () => {
56-
observer.post(event);
57-
expect(relativePath).to.not.be.empty;
58-
expect(infoMessage).to.not.be.empty;
59-
doClickOk();
60-
await commandDone;
61-
expect(invokedCommand).to.be.equal('dotnet.restore');
62-
});
63-
64-
test('Given an information message if the user clicks Restore, the command is executed', async () => {
65-
observer.post(event);
66-
doClickOk();
67-
await commandDone;
68-
expect(invokedCommand).to.be.equal('dotnet.restore');
40+
[
41+
{
42+
event: getUnresolvedDependenices("someFile"),
43+
expectedCommand: "dotnet.restore"
44+
}
45+
].forEach((elem) => {
46+
suite(elem.event.constructor.name, () => {
47+
suite('Suppress Dotnet Restore Notification is true', () => {
48+
setup(() => updateConfig(vscode, 'csharp', 'suppressDotnetRestoreNotification', true));
49+
50+
test('The information message is not shown', () => {
51+
observer.post(elem.event);
52+
expect(infoMessage).to.be.undefined;
53+
});
6954
});
7055

71-
test('Given an information message if the user clicks cancel, the command is not executed', async () => {
72-
observer.post(event);
73-
doClickCancel();
74-
await expect(Observable.fromPromise(commandDone).timeout(1).toPromise()).to.be.rejected;
75-
expect(invokedCommand).to.be.undefined;
56+
suite('Suppress Dotnet Restore Notification is false', () => {
57+
setup(() => updateConfig(vscode, 'csharp', 'suppressDotnetRestoreNotification', false));
58+
59+
test('The information message is shown', async () => {
60+
observer.post(elem.event);
61+
expect(relativePath).to.not.be.empty;
62+
expect(infoMessage).to.not.be.empty;
63+
doClickOk();
64+
await commandDone;
65+
expect(invokedCommand).to.be.equal(elem.expectedCommand);
66+
});
67+
68+
test('Given an information message if the user clicks Restore, the command is executed', async () => {
69+
observer.post(elem.event);
70+
doClickOk();
71+
await commandDone;
72+
expect(invokedCommand).to.be.equal(elem.expectedCommand);
73+
});
74+
75+
test('Given an information message if the user clicks cancel, the command is not executed', async () => {
76+
observer.post(elem.event);
77+
doClickCancel();
78+
await expect(Observable.fromPromise(commandDone).timeout(1).toPromise()).to.be.rejected;
79+
expect(invokedCommand).to.be.undefined;
80+
});
7681
});
7782
});
7883
});

test/unitTests/testAssets/Fakes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import * as vscode from '../../../src/vscodeAdapter';
77
import * as protocol from '../../../src/omnisharp/protocol';
8-
import { DocumentSelector, MessageItem, TextDocument, Uri, GlobPattern, WorkspaceConfiguration } from '../../../src/vscodeAdapter';
8+
import { DocumentSelector, MessageItem, TextDocument, Uri, GlobPattern } from '../../../src/vscodeAdapter';
99
import { ITelemetryReporter } from '../../../src/observers/TelemetryObserver';
1010
import { MSBuildDiagnosticsMessage } from '../../../src/omnisharp/protocol';
1111
import { OmnisharpServerMsBuildProjectDiagnostics, OmnisharpServerOnError, OmnisharpServerUnresolvedDependencies, WorkspaceInformationUpdated } from '../../../src/omnisharp/loggingEvents';

0 commit comments

Comments
 (0)