Skip to content

Commit c335ead

Browse files
committed
Remove the case and add the test
1 parent a347bba commit c335ead

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

src/observers/CsharpLoggerObserver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class CsharpLoggerObserver extends BaseLoggerObserver {
8383
this.logger.appendLine(`Package ${event.packageDescription} failed integrity check. Retrying..`);
8484
}
8585
else {
86-
this.logger.appendLine(`Package ${event.packageDescription} failed integrity check. Some features may not work as expected. Please restart Visual Studio Code to retrigger the download or download the package manually from ${event.url}`);
86+
this.logger.appendLine(`Package ${event.packageDescription} download from ${event.url} failed integrity check. Some features may not work as expected. Please restart Visual Studio Code to retrigger the download.`);
8787
}
8888
}
8989

src/observers/ErrorMessageObserver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class ErrorMessageObserver {
2929

3030
handleIntegrityCheckFailure(event: IntegrityCheckFailure) {
3131
if (!event.retry) {
32-
showErrorMessage(this.vscode, `Package ${event.packageDescription} failed integrity check. Some features may not work as expected. Please restart Visual Studio Code to retrigger the download or download the package manually from ${event.url}`);
32+
showErrorMessage(this.vscode, `Package ${event.packageDescription} download from ${event.url} failed integrity check. Some features may not work as expected. Please restart Visual Studio Code to retrigger the download`);
3333
}
3434
}
3535

test/unitTests/logging/CsharpLoggerObserver.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,12 @@ suite("CsharpLoggerObserver", () => {
170170
test(`${Event.IntegrityCheckFailure.name}: Package Description and url are logged when we are not retrying`, () => {
171171
let description = 'someDescription';
172172
let url = 'someUrl';
173-
let event = new Event.IntegrityCheckFailure(description, url, true);
173+
let event = new Event.IntegrityCheckFailure(description, url, false);
174174
observer.post(event);
175175
expect(logOutput).to.contain(description);
176+
expect(logOutput).to.contain(url);
176177
});
177-
178+
178179
test(`${Event.IntegrityCheckSuccess.name}: Some message is logged`, () => {
179180
let event = new Event.IntegrityCheckSuccess();
180181
observer.post(event);

test/unitTests/logging/ErrorMessageObserver.test.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getFakeVsCode } from '../testAssets/Fakes';
99
import 'rxjs/add/observable/fromPromise';
1010
import 'rxjs/add/operator/timeout';
1111
import { ErrorMessageObserver } from '../../../src/observers/ErrorMessageObserver';
12-
import { ZipError, DotNetTestRunFailure, DotNetTestDebugStartFailure, EventWithMessage } from '../../../src/omnisharp/loggingEvents';
12+
import { ZipError, DotNetTestRunFailure, DotNetTestDebugStartFailure, EventWithMessage, IntegrityCheckFailure } from '../../../src/omnisharp/loggingEvents';
1313

1414
chaiUse(require('chai-as-promised'));
1515
chaiUse(require('chai-string'));
@@ -40,4 +40,23 @@ suite("ErrorMessageObserver", () => {
4040
expect(errorMessage).to.be.contain(event.message);
4141
});
4242
});
43+
44+
suite(`${IntegrityCheckFailure.name}`, () => {
45+
test("Package Description and url are logged when we are not retrying", () => {
46+
let description = 'someDescription';
47+
let url = 'someUrl';
48+
let event = new IntegrityCheckFailure(description, url, false);
49+
observer.post(event);
50+
expect(errorMessage).to.contain(description);
51+
expect(errorMessage).to.contain(url);
52+
});
53+
54+
test("Nothing is shown if we are retrying", () => {
55+
let description = 'someDescription';
56+
let url = 'someUrl';
57+
let event = new IntegrityCheckFailure(description, url, true);
58+
observer.post(event);
59+
expect(errorMessage).to.be.undefined;
60+
});
61+
});
4362
});

0 commit comments

Comments
 (0)