diff --git a/Composer/packages/client/__tests__/components/TestController/publish-luis-modal.test.jsx b/Composer/packages/client/__tests__/components/TestController/publish-luis-modal.test.jsx new file mode 100644 index 0000000000..c3e74c0195 --- /dev/null +++ b/Composer/packages/client/__tests__/components/TestController/publish-luis-modal.test.jsx @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import * as React from 'react'; +import { fireEvent } from '@bfc/test-utils'; + +import { PublishLuis } from '../../../src/pages/language-understanding/publish-luis-modal'; +import { renderWithStore } from '../../testUtils'; + +describe('', () => { + it('should render the ', () => { + const onDismiss = jest.fn(() => {}); + const onPublish = jest.fn(() => {}); + const state = { + projectId: '12345', + botName: 'sampleBot0', + settings: { + luis: { + name: '', + authoringKey: '12345', + authoringEndpoint: 'testAuthoringEndpoint', + endpointKey: '12345', + endpoint: 'testEndpoint', + authoringRegion: 'westus', + defaultLanguage: 'en-us', + environment: 'composer', + }, + }, + }; + const actions = { + setSettings: jest.fn((projectId, settings) => { + state.settings = settings; + }), + }; + const { getByText } = renderWithStore( + , + state, + actions + ); + expect(getByText('What is the name of your bot?')).not.toBeNull(); + const publishButton = getByText('OK'); + expect(publishButton).not.toBeNull(); + fireEvent.click(publishButton); + expect(actions.setSettings).toBeCalled(); + expect(state).toEqual({ + projectId: '12345', + botName: 'sampleBot0', + settings: { + luis: { + name: 'sampleBot0', + authoringKey: '12345', + authoringEndpoint: 'testAuthoringEndpoint', + endpointKey: '12345', + endpoint: 'testEndpoint', + authoringRegion: 'westus', + defaultLanguage: 'en-us', + environment: 'composer', + }, + }, + }); + }); +}); diff --git a/Composer/packages/client/src/pages/language-understanding/publish-luis-modal.jsx b/Composer/packages/client/src/pages/language-understanding/publish-luis-modal.jsx index 6fc4f034ec..f6b0f375d5 100644 --- a/Composer/packages/client/src/pages/language-understanding/publish-luis-modal.jsx +++ b/Composer/packages/client/src/pages/language-understanding/publish-luis-modal.jsx @@ -109,6 +109,8 @@ export const PublishLuis = (props) => { authoringRegion: settings.luis.authoringRegion, defaultLanguage: settings.luis.defaultLanguage, environment: settings.luis.environment, + endpoint: settings.luis.endpoint, + authoringEndpoint: settings.luis.authoringEndpoint, errors: {}, }; diff --git a/Composer/packages/client/src/store/types.ts b/Composer/packages/client/src/store/types.ts index 5265fa52c5..ad51eb0de9 100644 --- a/Composer/packages/client/src/store/types.ts +++ b/Composer/packages/client/src/store/types.ts @@ -174,6 +174,8 @@ export interface ILuisConfig { name: string; authoringKey: string; endpointKey: string; + endpoint: string; + authoringEndpoint: string; authoringRegion: string | 'westus'; defaultLanguage: string | 'en-us'; environment: string | 'composer'; diff --git a/Composer/packages/server/src/models/bot/interface.ts b/Composer/packages/server/src/models/bot/interface.ts index 38ccdec5b3..52f22b9dde 100644 --- a/Composer/packages/server/src/models/bot/interface.ts +++ b/Composer/packages/server/src/models/bot/interface.ts @@ -26,6 +26,7 @@ export interface ILuisConfig { endpoint: string; authoringKey: string; endpointKey: string; + authoringEndpoint: string; authoringRegion: string | 'westus'; defaultLanguage: string | 'en-us'; environment: string | 'composer';