Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a splash screen to app startup. #1451

Merged
merged 1 commit into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Added
- [main] Added npm script to watch and auto-restart the main process in PR [1450](https://github.com/Microsoft/BotFramework-Emulator/pull/1450)
- [main] Added a splash screen to app startup in PR [1451](https://github.com/Microsoft/BotFramework-Emulator/pull/1451)

## Fixed
- [luis / client] Fixed several styling issues within the LUIS inspector, and enabled log deep link to configure missing LUIS service in PR [#1399](https://github.com/Microsoft/BotFramework-Emulator/pull/1399)
Expand Down
67 changes: 67 additions & 0 deletions packages/app/client/src/data/chatHelpers.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license.
//
// Microsoft Bot Framework: http://botframework.com
//
// Bot Framework Emulator Github:
// https://github.com/Microsoft/BotFramwork-Emulator
//
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// MIT License:
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

import { documentIdForConversation } from './chatHelpers';

let mockState;
const mockGetState = jest.fn(() => mockState);
const mockStore = {
getState: mockGetState,
};
jest.mock('./store', () => ({
get store() {
return mockStore;
},
}));

describe('chatHelpers', () => {
beforeEach(() => {
mockState = {};
mockGetState.mockClear();
});

test('documentIdForConversation', () => {
mockState = {
chat: {
chats: {
chat1: {
conversationId: 'conversation1',
documentId: 'someDocumentId',
},
},
},
};
expect(documentIdForConversation('conversation1')).toBe('someDocumentId');
expect(documentIdForConversation('nonExistentConversation')).toBe(undefined);
});
});
137 changes: 137 additions & 0 deletions packages/app/client/src/data/editorHelpers.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license.
//
// Microsoft Bot Framework: http://botframework.com
//
// Bot Framework Emulator Github:
// https://github.com/Microsoft/BotFramwork-Emulator
//
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// MIT License:
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

import * as Constants from '../constants';

import { open } from './action/editorActions';
import {
getOtherTabGroup,
getTabGroupForDocument,
hasNonGlobalTabs,
showWelcomePage,
tabGroupHasDocuments,
} from './editorHelpers';

let mockState;
const mockDispatch = jest.fn(() => null);
const mockGetState = jest.fn(() => mockState);
const mockStore = {
getState: mockGetState,
dispatch: mockDispatch,
};
jest.mock('./store', () => ({
get store() {
return mockStore;
},
}));

describe('editorHelpers', () => {
beforeEach(() => {
mockState = {};
mockGetState.mockClear();
mockDispatch.mockClear();
});

test('hasNonGlobalTabs', () => {
mockState = {
editor: {
editors: {
primary: {
documents: {
doc1: {},
doc2: {
isGlobal: true,
},
},
},
secondary: {
documents: {},
},
},
},
};

let result = !!hasNonGlobalTabs();
expect(result).toBe(true);

result = !!hasNonGlobalTabs(mockState.editor.editors);
expect(result).toBe(true);
});

test('getTabGroupForDocument', () => {
mockState = {
editor: {
editors: {
primary: {
documents: {
doc1: {},
doc2: {
isGlobal: true,
},
},
},
secondary: {
documents: {},
},
},
},
};

let result = getTabGroupForDocument('doc1');
expect(result).toBe('primary');

result = getTabGroupForDocument('doc3', mockState.editor.editors);
expect(result).toBe(undefined);
});

test('getOtherTabGroup', () => {
expect(getOtherTabGroup(Constants.EDITOR_KEY_PRIMARY)).toBe(Constants.EDITOR_KEY_SECONDARY);
expect(getOtherTabGroup(Constants.EDITOR_KEY_SECONDARY)).toBe(Constants.EDITOR_KEY_PRIMARY);
});

test('showWelcomePage', () => {
showWelcomePage();

expect(mockDispatch).toHaveBeenCalledWith(
open({
contentType: Constants.CONTENT_TYPE_WELCOME_PAGE,
documentId: Constants.DOCUMENT_ID_WELCOME_PAGE,
isGlobal: true,
})
);
});

test('tabGroupHasDocuments', () => {
expect(tabGroupHasDocuments({ documents: { doc1: {} } })).toBe(true);
});
});
Loading