Skip to content

Commit

Permalink
Fixed OAuth sign-in card flow.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyanziano committed Jun 26, 2019
1 parent 5e9a154 commit 1c089ca
Show file tree
Hide file tree
Showing 18 changed files with 349 additions and 205 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Fixed
- [client/main] Auto update is now opt-in by default and changed UX to reflect this in PR [1575](https://github.com/microsoft/BotFramework-Emulator/pull/1575)
- [client/main] Fixed OAuth card sign-in flow when not using magic code in PR [1660](https://github.com/microsoft/BotFramework-Emulator/pull/1660)

## v4.4.2 - 2019 - 05 - 28
## Fixed
Expand Down
12 changes: 12 additions & 0 deletions packages/app/main/src/appUpdater.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ jest.mock('./utils/sendNotificationToClient', () => ({
},
}));

jest.mock('./emulator', () => ({
Emulator: {
getInstance: () => ({
ngrok: {
ngrokEmitter: {
on: () => null,
},
},
}),
},
}));

describe('AppUpdater', () => {
let mockTrackEvent;
const trackEventBackup = TelemetryService.trackEvent;
Expand Down
3 changes: 1 addition & 2 deletions packages/app/main/src/commands/ngrokCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import { SharedConstants } from '@bfemulator/app-shared';
import { Command } from '@bfemulator/sdk-shared';

import { Emulator } from '../emulator';
import { kill } from '../ngrok';

const Commands = SharedConstants.Commands.Ngrok;

Expand All @@ -56,6 +55,6 @@ export class NgrokCommands {

@Command(Commands.KillProcess)
protected killNgrokProcess() {
return kill();
Emulator.getInstance().ngrok.kill();
}
}
3 changes: 1 addition & 2 deletions packages/app/main/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import * as commandLine from './commandLine';
import { Protocol } from './constants';
import { Emulator } from './emulator';
import './fetchProxy';
import { ngrokEmitter } from './ngrok';
import { Window } from './platform/window';
import { azureLoggedInUserChanged } from './settingsData/actions/azureAuthActions';
import { rememberBounds, rememberTheme } from './settingsData/actions/windowStateActions';
Expand Down Expand Up @@ -157,7 +156,7 @@ class EmulatorApplication {
}

private initializeNgrokListeners() {
ngrokEmitter.on('expired', this.onNgrokSessionExpired);
Emulator.getInstance().ngrok.ngrokEmitter.on('expired', this.onNgrokSessionExpired);
}

private initializeAppListeners() {
Expand Down
15 changes: 8 additions & 7 deletions packages/app/main/src/ngrok.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
import './fetchProxy';
import { ngrokEmitter } from './ngrok';
import * as ngrok from './ngrok';
import { intervals, NgrokInstance } from './ngrok';

const mockSpawn = {
on: () => {},
Expand Down Expand Up @@ -76,6 +75,8 @@ jest.mock('node-fetch', () => {
});

describe('the ngrok ', () => {
const ngrok = new NgrokInstance();

afterEach(() => {
ngrok.kill();
});
Expand Down Expand Up @@ -106,9 +107,9 @@ describe('the ngrok ', () => {

it('should emit when the ngrok session is expired', async () => {
mockOk = 0;
ngrok.intervals.retry = 100;
ngrok.intervals.expirationPoll = 1;
ngrok.intervals.expirationTime = -1;
intervals.retry = 100;
intervals.expirationPoll = 1;
intervals.expirationTime = -1;
let emitted = false;
ngrok.ngrokEmitter.on('expired', () => {
emitted = true;
Expand All @@ -127,7 +128,7 @@ describe('the ngrok ', () => {

it('should disconnect', async () => {
let disconnected = false;
ngrokEmitter.on('disconnect', url => {
ngrok.ngrokEmitter.on('disconnect', url => {
disconnected = true;
});

Expand All @@ -144,7 +145,7 @@ describe('the ngrok ', () => {
it('should throw when the number of reties to retrieve the ngrok url are exhausted', async () => {
mockOk = -101;
let threw = false;
ngrok.intervals.retry = 1;
intervals.retry = 1;
try {
await ngrok.connect({
addr: 61914,
Expand Down
Loading

0 comments on commit 1c089ca

Please sign in to comment.