Skip to content

Commit

Permalink
PostMigrationDialog unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Corina committed Nov 5, 2018
1 parent 9b1c236 commit 86604b4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/app/client/src/data/sagas/azureAuthSaga.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ jest.mock('../../ui/dialogs', () => ({
AzureLoginSuccessDialogContainer: () => undefined,
BotCreationDialog: () => undefined,
DialogService: { showDialog: () => Promise.resolve(true) },
PostMigrationDialogContainer: () => undefined,
SecretPromptDialog: () => undefined
}));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import * as React from 'react';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import { navBar } from '../../../data/reducer/navBar';
import { mount } from 'enzyme';
import { PostMigrationDialogContainer } from './postMigrationDialogContainer';
import { PostMigrationDialog, } from './postMigrationDialog';
import { CommandServiceImpl } from '../../../platform/commands/commandServiceImpl';

jest.mock('../../dialogs', () => ({}));

describe('The PostMigrationDialogContainer component', () => {
let wrapper;
let node;

beforeEach(() => {
wrapper = mount(
<Provider store={ createStore(navBar)} >
<PostMigrationDialogContainer />
</Provider>);
node = wrapper.find(PostMigrationDialog)
});

it('should render deeply', () => {
expect(wrapper.find(PostMigrationDialogContainer)).not.toBe(null);
expect(node.find(PostMigrationDialog)).not.toBe(null);
});

it('should contain a close function in the props', () => {
expect(typeof (node.props() as any).close).toBe('function');
});

it('should call the appropriate command when a link is clicked', () => {
const instance = node.instance();
const spy = jest.spyOn(CommandServiceImpl, 'remoteCall');
instance.onLearnMoreConfigAnchor();
expect(spy).toHaveBeenCalledWith('electron:open-external', 'https://aka.ms/about-bot-file');
instance.onLearnMoreNewFeaturesAnchor();
expect(spy).toHaveBeenCalledWith('electron:open-external', 'https://aka.ms/bot-framework-emulator-v4-overview');
});
});

0 comments on commit 86604b4

Please sign in to comment.