-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from microsoft/main
New commits
- Loading branch information
Showing
225 changed files
with
6,822 additions
and
1,384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
Composer/packages/client/__tests__/components/triggerCreationModal.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import * as React from 'react'; | ||
import { fireEvent, waitFor } from '@bfc/test-utils'; | ||
|
||
import { TriggerCreationModal } from '../../src/components/ProjectTree/TriggerCreationModal'; | ||
import { renderWithRecoil } from '../testUtils'; | ||
|
||
describe('<TriggerCreationModal/>', () => { | ||
const onSubmitMock = jest.fn(); | ||
const onDismissMock = jest.fn(); | ||
|
||
function renderComponent() { | ||
return renderWithRecoil( | ||
<TriggerCreationModal isOpen dialogId={'todobot'} onDismiss={onDismissMock} onSubmit={onSubmitMock} /> | ||
); | ||
} | ||
|
||
it('should render the component', () => { | ||
const component = renderComponent(); | ||
expect(component.container).toBeDefined(); | ||
}); | ||
|
||
it('hould create a Luis Intent recognized', async () => { | ||
const component = renderComponent(); | ||
const triggerType = component.getByTestId('triggerTypeDropDown'); | ||
fireEvent.click(triggerType); | ||
|
||
const luisOption = component.getByTitle('Intent recognized'); | ||
fireEvent.click(luisOption); | ||
const node = await waitFor(() => component.getByTestId('triggerFormSubmit')); | ||
expect(node).toBeDisabled(); | ||
}); | ||
|
||
it('should create a QnA Intent recognized', async () => { | ||
const component = renderComponent(); | ||
const triggerType = component.getByTestId('triggerTypeDropDown'); | ||
fireEvent.click(triggerType); | ||
|
||
const qnaOption = component.getByTitle('QnA Intent recognized'); | ||
fireEvent.click(qnaOption); | ||
|
||
const node = await waitFor(() => component.getByTestId('triggerFormSubmit')); | ||
expect(node).toBeEnabled(); | ||
}); | ||
}); |
75 changes: 75 additions & 0 deletions
75
Composer/packages/client/__tests__/pages/knowledge-base/QnAPage.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
/* eslint-disable react-hooks/rules-of-hooks */ | ||
import React from 'react'; | ||
|
||
import TableView from '../../../src/pages/knowledge-base/table-view'; | ||
import CodeEditor from '../../../src/pages/knowledge-base/code-editor'; | ||
import { renderWithRecoil } from '../../testUtils'; | ||
import { | ||
projectIdState, | ||
localeState, | ||
dialogsState, | ||
qnaFilesState, | ||
settingsState, | ||
schemasState, | ||
dispatcherState, | ||
} from '../../../src/recoilModel'; | ||
import mockProjectResponse from '../../../src/recoilModel/dispatchers/__tests__/mocks/mockProjectResponse.json'; | ||
|
||
const initialContent = ` | ||
# ?question | ||
\`\`\` | ||
answer | ||
\`\`\` | ||
`; | ||
|
||
const state = { | ||
projectId: 'test', | ||
dialogs: [{ id: '1' }, { id: '2' }], | ||
locale: 'en-us', | ||
qnaFiles: [ | ||
{ | ||
id: 'a.en-us', | ||
content: initialContent, | ||
qnaSections: [ | ||
{ | ||
Questions: [{ content: 'question', id: 1 }], | ||
Answer: 'answer', | ||
uuid: 1, | ||
}, | ||
], | ||
}, | ||
], | ||
settings: { | ||
defaultLanguage: 'en-us', | ||
languages: ['en-us', 'fr-fr'], | ||
}, | ||
}; | ||
|
||
const updateQnAFileMock = jest.fn(); | ||
|
||
const initRecoilState = ({ set }) => { | ||
set(projectIdState, state.projectId); | ||
set(localeState, state.locale); | ||
set(dialogsState, state.dialogs); | ||
set(qnaFilesState, state.qnaFiles); | ||
set(settingsState, state.settings); | ||
set(schemasState, mockProjectResponse.schemas); | ||
set(dispatcherState, { | ||
updateQnAFile: updateQnAFileMock, | ||
}); | ||
}; | ||
|
||
describe('QnA page all up view', () => { | ||
it('should render QnA page table view', () => { | ||
const { getByText, getByTestId } = renderWithRecoil(<TableView dialogId={'a'} />, initRecoilState); | ||
getByTestId('table-view'); | ||
getByText('question (1)'); | ||
getByText('answer'); | ||
}); | ||
|
||
it('should render QnA page code editor', () => { | ||
renderWithRecoil(<CodeEditor dialogId={'a'} />, initRecoilState); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.