Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
04e0b34
Fix path
May 6, 2020
9297d96
Merge branch 'master' of https://github.com/Microsoft/vscode-python
May 6, 2020
9f3d5ac
Merge branch 'master' of https://github.com/Microsoft/vscode-python
May 11, 2020
607bf98
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Jun 1, 2020
e566214
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Jun 11, 2020
4477900
Actually fix settings
Jun 18, 2020
d0d50de
Add news
Jun 18, 2020
03aa5f9
Add test
Jun 18, 2020
e4a032f
Format
Jun 18, 2020
27eeec7
Suppress 'jediEnabled' removal
Jun 18, 2020
89f432e
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Jun 23, 2020
3ed655b
Drop survey first launch threshold
Jun 26, 2020
64ac38a
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Jun 29, 2020
52a4325
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Jun 30, 2020
67d7cb8
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Jul 8, 2020
0ce6d91
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Jul 22, 2020
571115e
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Jul 30, 2020
41fbcbb
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Aug 4, 2020
8fee970
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Aug 10, 2020
67ea545
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Aug 17, 2020
09f2567
Initial
Aug 18, 2020
b8733af
Add test
Aug 19, 2020
f7aa66b
PR feedback
Aug 20, 2020
d73986c
Rename property
Aug 20, 2020
7d694f0
Rename constant
Aug 20, 2020
e37bef9
Define property
Aug 20, 2020
58f82e8
Moar rename
Aug 20, 2020
e70e9ad
casing
Aug 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test
  • Loading branch information
Mikhail Arkhipov
Mikhail Arkhipov committed Aug 19, 2020
commit b8733afa1a2a3f316e38f418105cdb9dd6321866
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// Licensed under the MIT License.

'use strict';

import { expect } from 'chai';
import { assert, expect } from 'chai';
import * as sinon from 'sinon';
import * as typemoq from 'typemoq';
import { Extension } from 'vscode';
Expand Down Expand Up @@ -50,7 +49,7 @@ suite('Propose Pylance Banner', () => {
let appEnv: typemoq.IMock<IApplicationEnvironment>;
let settings: typemoq.IMock<IPythonSettings>;
let sendTelemetryStub: sinon.SinonStub;
let telemetryEvent: { eventName: EventName; hasCustomEnvPath: boolean } | undefined;
let telemetryEvent: { eventName: EventName } | undefined;

const message = Pylance.proposePylanceMessage();
const yes = Pylance.tryItNow();
Expand All @@ -65,18 +64,19 @@ suite('Propose Pylance Banner', () => {
appEnv = typemoq.Mock.ofType<IApplicationEnvironment>();
appEnv.setup((x) => x.uriScheme).returns(() => 'scheme');

const mockSendTelemetryEvent = (
eventName: EventName,
_: number | undefined,
{ hasCustomEnvPath }: { hasCustomEnvPath: boolean }
) => {
const mockSendTelemetryEvent = (eventName: EventName) => {
telemetryEvent = {
eventName,
hasCustomEnvPath
eventName
};
};
sendTelemetryStub = sinon.stub(Telemetry, 'sendTelemetryEvent').callsFake(mockSendTelemetryEvent);
});

teardown(() => {
telemetryEvent = undefined;
sinon.restore();
});

testData.forEach((t) => {
test(`${t.inExperiment ? 'In' : 'Not in'} experiment and "python.languageServer": "${t.lsType}" should ${
t.shouldShowBanner ? 'show' : 'not show'
Expand Down Expand Up @@ -126,8 +126,12 @@ suite('Propose Pylance Banner', () => {

const testBanner = preparePopup(true, appShell.object, appEnv.object, config.object, true, false);
await testBanner.showBanner();

expect(testBanner.enabled).to.be.equal(false, 'Banner should be permanently disabled when user clicked No');
appShell.verifyAll();

sinon.assert.calledOnce(sendTelemetryStub);
assert.deepEqual(telemetryEvent, { eventName: EventName.PYLANCE_LANGUAGE_SERVER_SWITCH_NO });
});
test('Clicking Later should disable banner in session', async () => {
appShell
Expand All @@ -145,11 +149,15 @@ suite('Propose Pylance Banner', () => {

const testBanner = preparePopup(true, appShell.object, appEnv.object, config.object, true, false);
await testBanner.showBanner();

expect(testBanner.enabled).to.be.equal(
true,
'Banner should not be permanently disabled when user clicked Later'
);
appShell.verifyAll();

sinon.assert.calledOnce(sendTelemetryStub);
assert.deepEqual(telemetryEvent, { eventName: EventName.PYLANCE_LANGUAGE_SERVER_SWITCH_LATER });
});
test('Clicking Yes opens the extension marketplace entry', async () => {
appShell
Expand All @@ -167,8 +175,12 @@ suite('Propose Pylance Banner', () => {

const testBanner = preparePopup(true, appShell.object, appEnv.object, config.object, true, false);
await testBanner.showBanner();

expect(testBanner.enabled).to.be.equal(false, 'Banner should be permanently disabled after opening store URL');
appShell.verifyAll();

sinon.assert.calledOnce(sendTelemetryStub);
assert.deepEqual(telemetryEvent, { eventName: EventName.PYLANCE_LANGUAGE_SERVER_SWITCH_YES });
});
});

Expand Down