Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit 45635ca

Browse files
committed
rm ngroc from tests
1 parent 150fc04 commit 45635ca

14 files changed

Lines changed: 19 additions & 177 deletions

File tree

packages/app/client/src/state/sagas/frameworkSettingsSagas.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,12 @@ describe('The frameworkSettingsSagas', () => {
120120
useCustomId: false,
121121
usePrereleases: false,
122122
userGUID: '',
123-
ngrokPath: 'some/path/to/ngrok',
124123
};
125124
const updatedSettings: Partial<FrameworkSettings> = {
126125
autoUpdate: true,
127126
useCustomId: true,
128127
usePrereleases: false,
129128
userGUID: 'some-user-id',
130-
ngrokPath: 'some/different/path/to/ngrok',
131129
};
132130
const gen = FrameworkSettingsSagas.saveFrameworkSettings(saveFrameworkSettingsAction(updatedSettings));
133131
// selector to get the active document from the state
@@ -147,7 +145,6 @@ describe('The frameworkSettingsSagas', () => {
147145
autoUpdate: true,
148146
useCustomId: true,
149147
userGUID: 'some-user-id',
150-
ngrokPath: 'some/different/path/to/ngrok',
151148
}
152149
)
153150
);

packages/app/client/src/ui/editor/emulator/parts/log/logEntry.spec.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,6 @@ describe('logEntry component', () => {
316316
expect(networkResItem).not.toBeNull();
317317
});
318318

319-
it('should render an ngrok expiration item', () => {
320-
wrapper = mount(<LogEntry {...props} />);
321-
instance = wrapper.instance();
322-
const ngrokitem = instance.renderItem({ type: 'ngrok-expiration', payload: { text: 'some text' } }, 'someKey');
323-
expect(ngrokitem).not.toBeNull();
324-
});
325-
326319
it('should render a luis editor deep link item', () => {
327320
wrapper = mount(<LogEntry {...props} />);
328321
instance = wrapper.instance();

packages/app/client/src/utils/getSettingsDelta.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,13 @@ describe('getSettingsDelta', () => {
4141
};
4242
const updatedSettings: Partial<FrameworkSettings> = {
4343
autoUpdate: true,
44-
runNgrokAtStartup: true,
4544
use10Tokens: false,
4645
usePrereleases: false,
4746
userGUID: 'some-other-id',
4847
};
4948

5049
expect(getSettingsDelta(currentSettings, updatedSettings)).toEqual({
5150
locale: undefined,
52-
runNgrokAtStartup: true,
5351
use10Tokens: false,
5452
usePrereleases: false,
5553
userGUID: 'some-other-id',

packages/app/main/src/appMenuBuilder.spec.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,7 @@ jest.mock('./appUpdater', () => ({
144144
jest.mock('./emulator', () => ({
145145
Emulator: {
146146
initialize: jest.fn(),
147-
getInstance: () => ({
148-
ngrok: {
149-
broadcastNgrokExpired: () => null,
150-
ngrokEmitter: {
151-
on: () => null,
152-
},
153-
},
154-
}),
147+
getInstance: () => ({}),
155148
},
156149
}));
157150

packages/app/main/src/appUpdater.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,7 @@ jest.mock('./utils/sendNotificationToClient', () => ({
137137
jest.mock('./emulator', () => ({
138138
Emulator: {
139139
initialize: jest.fn(),
140-
getInstance: () => ({
141-
ngrok: {
142-
ngrokEmitter: {
143-
on: () => null,
144-
},
145-
},
146-
}),
140+
getInstance: () => ({}),
147141
},
148142
}));
149143

packages/app/main/src/commands/emulatorCommands.spec.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,6 @@ const mockEmulator = {
168168
},
169169
getServiceUrl: () => 'http://localhost:6728',
170170
},
171-
ngrok: {
172-
getServiceUrl: () => 'http://localhost:5678',
173-
},
174171
};
175172
jest.mock('../emulator', () => ({
176173
Emulator: {
@@ -256,7 +253,7 @@ const mockConversation = mockEmulator.server.state.conversations.newConversation
256253
id: '0a441b55-d1d6-4015-bbb4-2e7f44fa9f42',
257254
name: 'User',
258255
},
259-
serviceUrl: 'https://a457e760.ngrok.io',
256+
serviceUrl: 'https://a457e760.mytunnel.io',
260257
},
261258
},
262259
{
@@ -285,14 +282,14 @@ const mockConversation = mockEmulator.server.state.conversations.newConversation
285282
id: '0a441b55-d1d6-4015-bbb4-2e7f44fa9f42',
286283
name: 'User',
287284
},
288-
serviceUrl: 'https://a457e760.ngrok.io',
285+
serviceUrl: 'https://a457e760.mytunnel.io',
289286
},
290287
},
291288
{
292289
type: 'activity add',
293290
activity: {
294291
type: 'message',
295-
serviceUrl: 'https://a457e760.ngrok.io',
292+
serviceUrl: 'https://a457e760.mytunnel.io',
296293
channelId: 'emulator',
297294
from: {
298295
id: 'http://localhost:3978/api/messages',
@@ -318,7 +315,7 @@ const mockConversation = mockEmulator.server.state.conversations.newConversation
318315
type: 'activity add',
319316
activity: {
320317
type: 'message',
321-
serviceUrl: 'https://a457e760.ngrok.io',
318+
serviceUrl: 'https://a457e760.mytunnel.io',
322319
channelId: 'emulator',
323320
from: {
324321
id: 'http://localhost:3978/api/messages',
@@ -344,7 +341,7 @@ const mockConversation = mockEmulator.server.state.conversations.newConversation
344341
type: 'activity add',
345342
activity: {
346343
type: 'message',
347-
serviceUrl: 'https://a457e760.ngrok.io',
344+
serviceUrl: 'https://a457e760.mytunnel.io',
348345
channelId: 'emulator',
349346
from: {
350347
id: 'http://localhost:3978/api/messages',
@@ -636,9 +633,9 @@ describe('The emulatorCommands', () => {
636633
expect(mockTrackEvent).toHaveBeenCalledWith('sendActivity_deleteUserData');
637634
});
638635

639-
it('should get the current ngrok service url', async () => {
636+
it('should get the current service url', async () => {
640637
const url = await registry.getCommand(SharedConstants.Commands.Emulator.GetServiceUrl)();
641638

642-
expect(url).toBe('http://localhost:5678');
639+
expect(url).toBe('http://localhost:6728');
643640
});
644641
});

packages/app/main/src/protocolHandler.spec.ts

Lines changed: 2 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -71,32 +71,19 @@ jest.mock('./globals', () => ({
7171
setGlobal: () => null,
7272
}));
7373

74-
let mockNgrokPath;
7574
const mockDispatch = jest.fn();
7675
jest.mock('./state/store', () => ({
7776
store: {
7877
dispatch: action => mockDispatch(action),
7978
},
8079
getSettings: () => ({
81-
framework: {
82-
ngrokPath: mockNgrokPath,
83-
},
80+
framework: {},
8481
}),
8582
}));
8683

87-
let mockGetSpawnStatus: any = jest.fn(() => ({ triedToSpawn: true }));
88-
let mockRunningStatus;
8984
const mockRecycle = jest.fn(() => null);
9085
const mockEmulator = {
9186
framework: { serverUrl: 'http://[::]:8090' },
92-
ngrok: {
93-
getSpawnStatus: () => mockGetSpawnStatus(),
94-
ngrokEmitter: {
95-
once: (_eventName, cb) => cb(),
96-
},
97-
recycle: () => mockRecycle(),
98-
running: () => mockRunningStatus,
99-
},
10087
};
10188
jest.mock('./emulator', () => ({
10289
Emulator: {
@@ -178,15 +165,12 @@ describe('Protocol handler tests', () => {
178165
},
179166
],
180167
};
181-
mockRunningStatus = true;
182-
mockNgrokPath = 'path/to/ngrok.exe';
183168
mockSendNotificationToClient = jest.fn(() => null);
184169
mockGotReturnValue = {
185170
statusCode: 200,
186171
body: '["activity1", "activity2", "activity3"]',
187172
};
188173
mockRecycle.mockClear();
189-
mockGetSpawnStatus.mockClear();
190174
mockDispatch.mockClear();
191175
});
192176

@@ -377,7 +361,7 @@ describe('Protocol handler tests', () => {
377361
});
378362
});
379363

380-
it('should open a bot when ngrok is running', async () => {
364+
it('should open a bot', async () => {
381365
const protocol = {
382366
parsedArgs: {
383367
id: 'someIdOverride',
@@ -388,9 +372,6 @@ describe('Protocol handler tests', () => {
388372
const overrides = { endpoint: parseEndpointOverrides(protocol.parsedArgs) };
389373
const overriddenBot = applyBotConfigOverrides(mockOpenedBot, overrides);
390374

391-
// ngrok should be kick-started if it hasn't tried to spawn yet
392-
mockGetSpawnStatus = jest.fn(() => ({ triedToSpawn: false }));
393-
394375
await ProtocolHandler.openBot(protocol);
395376

396377
expect(mockRecycle).toHaveBeenCalled();
@@ -409,96 +390,6 @@ describe('Protocol handler tests', () => {
409390
});
410391
});
411392

412-
it('should open a bot when ngrok is configured but not running', async () => {
413-
mockRunningStatus = false;
414-
const protocol = {
415-
parsedArgs: {
416-
id: 'someIdOverride',
417-
path: 'path/to/bot.bot',
418-
secret: 'someSecret',
419-
},
420-
};
421-
const overrides = { endpoint: parseEndpointOverrides(protocol.parsedArgs) };
422-
const overriddenBot = applyBotConfigOverrides(mockOpenedBot, overrides);
423-
424-
await ProtocolHandler.openBot(protocol);
425-
426-
expect(mockCallsMade).toHaveLength(2);
427-
expect(mockCallsMade[0].commandName).toBe(SharedConstants.Commands.Bot.Open);
428-
expect(mockCallsMade[0].args).toEqual(['path/to/bot.bot', 'someSecret']);
429-
expect(mockCallsMade[1].commandName).toBe(SharedConstants.Commands.Bot.SetActive);
430-
expect(mockCallsMade[1].args).toEqual([overriddenBot]);
431-
expect(mockRemoteCallsMade).toHaveLength(1);
432-
expect(mockRemoteCallsMade[0].commandName).toBe(SharedConstants.Commands.Bot.Load);
433-
expect(mockRemoteCallsMade[0].args).toEqual([overriddenBot]);
434-
expect(mockTrackEvent).toHaveBeenCalledWith('bot_open', {
435-
method: 'protocol',
436-
numOfServices: 1,
437-
source: 'path',
438-
});
439-
});
440-
441-
it('should open a bot when ngrok is not configured', async () => {
442-
mockNgrokPath = undefined;
443-
const protocol = {
444-
parsedArgs: {
445-
id: 'someIdOverride',
446-
path: 'path/to/bot.bot',
447-
secret: 'someSecret',
448-
},
449-
};
450-
const overrides = { endpoint: parseEndpointOverrides(protocol.parsedArgs) };
451-
const overriddenBot = applyBotConfigOverrides(mockOpenedBot, overrides);
452-
453-
await ProtocolHandler.openBot(protocol);
454-
455-
expect(mockCallsMade).toHaveLength(2);
456-
expect(mockCallsMade[0].commandName).toBe(SharedConstants.Commands.Bot.Open);
457-
expect(mockCallsMade[0].args).toEqual(['path/to/bot.bot', 'someSecret']);
458-
expect(mockCallsMade[1].commandName).toBe(SharedConstants.Commands.Bot.SetActive);
459-
expect(mockCallsMade[1].args).toEqual([overriddenBot]);
460-
expect(mockRemoteCallsMade).toHaveLength(1);
461-
expect(mockRemoteCallsMade[0].commandName).toBe(SharedConstants.Commands.Bot.Load);
462-
expect(mockRemoteCallsMade[0].args).toEqual([overriddenBot]);
463-
expect(mockTrackEvent).toHaveBeenCalledWith('bot_open', {
464-
method: 'protocol',
465-
numOfServices: 1,
466-
source: 'path',
467-
});
468-
});
469-
470-
it('should throw if ngrok failed to spawn while opening a bot', async () => {
471-
try {
472-
const protocol = {
473-
parsedArgs: {
474-
id: 'someIdOverride',
475-
path: 'path/to/bot.bot',
476-
secret: 'someSecret',
477-
},
478-
};
479-
mockGetSpawnStatus = jest.fn(() => ({ triedToSpawn: true, err: 'Some ngrok error' }));
480-
await ProtocolHandler.openBot(protocol);
481-
} catch (e) {
482-
expect(e).toEqual(new Error('Error while trying to spawn ngrok instance: Some ngrok error'));
483-
}
484-
});
485-
486-
it('should throw if ngrok failed to spawn while opening a livechat', async () => {
487-
try {
488-
const protocol = {
489-
parsedArgs: {
490-
botUrl: 'someUrl',
491-
msaAppId: 'someAppId',
492-
msaPassword: 'somePw',
493-
},
494-
};
495-
mockGetSpawnStatus = jest.fn(() => ({ triedToSpawn: true, err: 'Some ngrok error' }));
496-
await ProtocolHandler.openBot(protocol);
497-
} catch (e) {
498-
expect(e).toEqual(new Error('Error while trying to spawn ngrok instance: Some ngrok error'));
499-
}
500-
});
501-
502393
it('should open a transcript from a url', async () => {
503394
const protocol = {
504395
parsedArgs: { url: 'https://www.test.com/convo1.transcript' },

packages/app/main/src/server/routes/channel/conversations/handlers/replyToActivity.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,12 @@ describe('replyToActivity route middleware', () => {
127127
});
128128

129129
it('should log any exceptions from OAuth signin in generation before posting the activity to the user', async () => {
130-
const ngrokError = new Error('Failed to spawn ngrok');
131-
mockResolveOAuthCards.mockRejectedValueOnce(ngrokError);
132130
createReplyToActivityHandler(mockEmulatorServer)(mockReq, mockRes, mockNext);
133131

134132
// since the middleware is not an async function, wait for the async operations to complete
135133
await new Promise(resolve => setTimeout(resolve, 500));
136134

137-
expect(mockEmulatorServer.logger.logException).toHaveBeenCalledWith('someConversationId', ngrokError);
135+
expect(mockEmulatorServer.logger.logException).toHaveBeenCalledWith('someConversationId');
138136
expect(mockEmulatorServer.logger.logException).toHaveBeenCalledWith(
139137
'someConversationId',
140138
new Error('Falling back to emulated OAuth token.')

packages/app/main/src/server/routes/channel/userToken/handlers/tokenResponse.spec.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ describe('tokenResponseHandler', () => {
5656
};
5757
const mockSendTokenResponse = jest.fn().mockResolvedValue({ statusCode: HttpStatus.OK });
5858
const emulatorServer: any = {
59-
shutDownOAuthNgrokInstance: jest.fn(),
6059
state: {
6160
conversations: {
6261
conversationById: jest.fn(() => ({
@@ -70,7 +69,6 @@ describe('tokenResponseHandler', () => {
7069

7170
expect(mockSendTokenResponse).toHaveBeenCalledWith(req.body.connectionName, req.body.token, false);
7271
expect(res.send).toHaveBeenCalledWith(HttpStatus.OK, req.body);
73-
expect(emulatorServer.shutDownOAuthNgrokInstance).toHaveBeenCalled();
7472
});
7573

7674
it('should return the status code of sending the token response if it is not 200', async () => {
@@ -84,7 +82,6 @@ describe('tokenResponseHandler', () => {
8482
};
8583
const mockSendTokenResponse = jest.fn().mockResolvedValue({ statusCode: HttpStatus.BAD_REQUEST });
8684
const emulatorServer: any = {
87-
shutDownOAuthNgrokInstance: jest.fn(),
8885
state: {
8986
conversations: {
9087
conversationById: jest.fn(() => ({
@@ -98,7 +95,6 @@ describe('tokenResponseHandler', () => {
9895

9996
expect(mockSendTokenResponse).toHaveBeenCalledWith(req.body.connectionName, req.body.token, false);
10097
expect(res.send).toHaveBeenCalledWith(HttpStatus.BAD_REQUEST);
101-
expect(emulatorServer.shutDownOAuthNgrokInstance).toHaveBeenCalled();
10298
});
10399

104100
it('should send an error response if something goes wrong', async () => {
@@ -111,7 +107,6 @@ describe('tokenResponseHandler', () => {
111107
send: jest.fn(),
112108
};
113109
const emulatorServer: any = {
114-
shutDownOAuthNgrokInstance: jest.fn(),
115110
state: {
116111
conversations: {
117112
conversationById: jest.fn(() => ({
@@ -124,6 +119,5 @@ describe('tokenResponseHandler', () => {
124119
await tokenResponse(req, res);
125120

126121
expect(mockSendErrorResponse).toHaveBeenCalledWith(req, res, null, new Error('Could not send token response.'));
127-
expect(emulatorServer.shutDownOAuthNgrokInstance).toHaveBeenCalled();
128122
});
129123
});

packages/app/main/src/server/routes/emulator/handlers/initialReport.spec.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ import { createInitialReportHandler } from './initialReport';
3737

3838
jest.mock('../../../../emulator', () => ({
3939
Emulator: {
40-
getInstance: () => ({
41-
ngrok: {
42-
report: jest.fn(),
43-
},
44-
}),
40+
getInstance: () => ({}),
4541
},
4642
}));
4743

0 commit comments

Comments
 (0)