Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
a551b4c
rebuild qna CRUD and qna page UI (#3692)
liweitian Jul 23, 2020
ca82de6
rebase
alanlong9278 Jul 24, 2020
051ada7
Rebuild qna (#3701)
liweitian Jul 24, 2020
d44e29b
debug
alanlong9278 Jul 24, 2020
aa1b3f2
Merge branch 'julong/qna' into qna-recognizer
alanlong9278 Jul 24, 2020
a8dba4b
add qna trigger type (#3703)
liweitian Jul 24, 2020
f856ab7
Merge branch 'main' into qna-recognizer
alanlong9278 Jul 25, 2020
9bfb896
resolve conflict
alanlong9278 Jul 25, 2020
c6d18ca
bug fix
alanlong9278 Jul 25, 2020
4e1cadf
refine qna crud (#3711)
liweitian Jul 25, 2020
813ebfa
Update Program.cs
luhan2017 Jul 26, 2020
1fd7e61
fix bug (#3715)
liweitian Jul 26, 2020
095a5e0
bugfix: start bot pop error message for new echo bot
alanlong9278 Jul 26, 2020
528af9e
revert the change on common.lg
luhan2017 Jul 27, 2020
7119848
send qna endpointKey to runtime
VanyLaw Jul 27, 2020
f6433b9
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
VanyLaw Jul 27, 2020
9587931
publish pop
alanlong9278 Jul 27, 2020
5c0226d
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
alanlong9278 Jul 27, 2020
303e9c8
eslint
alanlong9278 Jul 27, 2020
1942e97
Regression on publish page after recoil
lei9444 Jul 27, 2020
9769e86
clean some code
lei9444 Jul 27, 2020
764e85f
recognizer dropdown & custom default content
alanlong9278 Jul 27, 2020
32397b1
migration
alanlong9278 Jul 27, 2020
0612a46
fix files structure change
VanyLaw Jul 27, 2020
c6677a4
fix object can only read
lei9444 Jul 27, 2020
e152ae2
add botProject interface and move some interface into shared folder
VanyLaw Jul 27, 2020
a0538a3
fix lint
VanyLaw Jul 27, 2020
1d8219d
update trigger action (#3720)
liweitian Jul 27, 2020
f049d7e
Merge branch 'wenyluo/fixPublish' into qna-recognizer
alanlong9278 Jul 27, 2020
d34e7dc
Merge remote-tracking branch 'leilei/history' into qna-recognizer
alanlong9278 Jul 27, 2020
a1913e6
merge publish error fixed
alanlong9278 Jul 27, 2020
a6c86b6
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
alanlong9278 Jul 27, 2020
aee6705
Update package to include the resourc id fix
luhan2017 Jul 27, 2020
330ab46
Merge branch 'main' into qna-recognizer
alanlong9278 Jul 28, 2020
32e0bcf
add id for dialog & migrate it with old bot
alanlong9278 Jul 28, 2020
4b82c28
crosstrain config
alanlong9278 Jul 28, 2020
49e127a
eslint & qna jump
alanlong9278 Jul 28, 2020
3701dd1
migration old bot for recognizer
alanlong9278 Jul 28, 2020
a97f954
migration old bot for recognizer
alanlong9278 Jul 28, 2020
b9e47c1
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
alanlong9278 Jul 28, 2020
ce0b1c8
Merge branch 'main' into qna-recognizer
alanlong9278 Jul 29, 2020
57c490c
revert rootId in luUtil
alanlong9278 Jul 29, 2020
6167cb0
change qna location
alanlong9278 Jul 29, 2020
a24f2e1
refactor publish logic
alanlong9278 Jul 29, 2020
668c29c
cross train when default recognizer
alanlong9278 Jul 29, 2020
30e0c6b
sync cross train config logic with azure deploy
alanlong9278 Jul 29, 2020
d1e5c9f
fix bug (#3748)
liweitian Jul 30, 2020
8f71461
Update the sdk package to include expandText fix
luhan2017 Jul 30, 2020
bda96ba
solve conflict
liweitian Jul 31, 2020
e146402
Merge branch 'main' into qna-recognizer
alanlong9278 Jul 31, 2020
5b5733e
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
alanlong9278 Jul 31, 2020
e469f85
resolve conflict
alanlong9278 Jul 31, 2020
a73b5e3
cross train config filter no body trigger intent
alanlong9278 Jul 31, 2020
02e6b00
deploy logic change
alanlong9278 Aug 2, 2020
ac32a1c
azure deploy bugfix
alanlong9278 Aug 3, 2020
d10fd80
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 3, 2020
bcd68ee
yarn
alanlong9278 Aug 3, 2020
75bac59
typecheck error
alanlong9278 Aug 3, 2020
f15ae7b
Qna recognizer tmp (#3765)
liweitian Aug 3, 2020
a0dc1b8
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
alanlong9278 Aug 3, 2020
2f0bbe4
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 3, 2020
490fc48
set max memory for build
alanlong9278 Aug 3, 2020
fd09573
refactor qna popup logic && form editor ux
alanlong9278 Aug 3, 2020
d29197b
Update trigger (#3768)
liweitian Aug 3, 2020
9bec31b
update trigger (#3772)
liweitian Aug 4, 2020
c498610
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 4, 2020
8dcde69
fix export bug (#3776)
liweitian Aug 4, 2020
225954b
separates Form / Flow's ExtensionContext
yeze322 Aug 5, 2020
0a7242b
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 5, 2020
efb63b3
test fixed
alanlong9278 Aug 5, 2020
ab50def
fix trigger actions bug (#3787)
liweitian Aug 5, 2020
2729fab
Merge branch 'extension/separate-context' into qna-recognizer
alanlong9278 Aug 5, 2020
db9e323
fix trigger bug (#3788)
liweitian Aug 5, 2020
4bae777
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
alanlong9278 Aug 5, 2020
b2892de
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 7, 2020
c87e577
conflict err
alanlong9278 Aug 7, 2020
842d09f
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 10, 2020
723fa07
update bf-lu package & fix conflict err
alanlong9278 Aug 10, 2020
2e263ac
Creating qn a sample (#3819)
liweitian Aug 10, 2020
805de15
fix bug
liweitian Aug 10, 2020
92f839f
fix bug (#3822)
liweitian Aug 10, 2020
cc8d70b
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 11, 2020
7da0444
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
liweitian Aug 11, 2020
d9dd544
test for build qna & lu in server
alanlong9278 Aug 11, 2020
cdbc957
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 12, 2020
051b89b
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
liweitian Aug 12, 2020
0f2fe1c
Update qn a flow (#3831)
liweitian Aug 12, 2020
d939a82
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
liweitian Aug 12, 2020
d830ae2
Fix ui bug (#3833)
liweitian Aug 12, 2020
66fa1a8
Update autoEndDialog to false
luhan2017 Aug 12, 2020
fae8b9e
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
liweitian Aug 12, 2020
1a96e7d
Navigate to qna page (#3834)
liweitian Aug 12, 2020
83ebaba
Updates
cwhitten Aug 12, 2020
cfe6a4b
Fix
cwhitten Aug 12, 2020
64d7572
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
liweitian Aug 13, 2020
8f1bb62
refine code
liweitian Aug 14, 2020
afaac2a
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 14, 2020
82b819e
refactor & add comment
alanlong9278 Aug 14, 2020
dffffa9
refine code"
liweitian Aug 14, 2020
dae16bc
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
liweitian Aug 14, 2020
19cacaa
Merge branch 'codeRefine' into qna-recognizer
liweitian Aug 14, 2020
ecb3285
handle comments
liweitian Aug 14, 2020
4444467
popup desc
alanlong9278 Aug 14, 2020
c1136f5
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
alanlong9278 Aug 14, 2020
e620409
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 17, 2020
13f6930
hidden the subsription key
lei9444 Aug 17, 2020
a17bbd9
recognizer
alanlong9278 Aug 17, 2020
71da2e0
replace the default name with unique id
lei9444 Aug 17, 2020
6161733
use common component to show error
lei9444 Aug 17, 2020
ab21bf6
comments
alanlong9278 Aug 17, 2020
f8976d0
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
alanlong9278 Aug 17, 2020
33f3495
update UI
liweitian Aug 17, 2020
84eedcc
Merge branch 'updateUI' into qna-recognizer
liweitian Aug 17, 2020
13d3e22
fix the qna icon reload issue
lei9444 Aug 17, 2020
878b73b
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
lei9444 Aug 17, 2020
14a2bd2
fix UI bug
liweitian Aug 17, 2020
e918dae
Merge branch 'updateUI2' into qna-recognizer
liweitian Aug 17, 2020
679f71c
change hover color
liweitian Aug 17, 2020
b854a9c
remove toggle on row
liweitian Aug 17, 2020
0031ff6
qna endpointKey
alanlong9278 Aug 18, 2020
3b28c58
popup
alanlong9278 Aug 18, 2020
b69b0fa
add try catch for get qna endpointKey
alanlong9278 Aug 18, 2020
b027cc9
update UI
liweitian Aug 18, 2020
2cf9321
Merge branch 'updateUI3' into qna-recognizer
liweitian Aug 18, 2020
e372325
remove the scroll bar and update the error display
lei9444 Aug 18, 2020
4f2d621
update qna UI
liweitian Aug 18, 2020
213fd82
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 18, 2020
0461d3f
input luis hoisting
alanlong9278 Aug 18, 2020
b6b9580
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 19, 2020
85d3c10
conflict
alanlong9278 Aug 19, 2020
d5fe6a3
comments
alanlong9278 Aug 19, 2020
4b1df69
test fixed
alanlong9278 Aug 19, 2020
24af369
test fixed
alanlong9278 Aug 19, 2020
0d63554
handle comments
liweitian Aug 19, 2020
2039ab2
Merge branch 'handleComments' into qna-recognizer
liweitian Aug 19, 2020
98a3b7e
separated QnAEditor & rename to knowledge-base (#3857)
zhixzhan Aug 19, 2020
a9642ae
fix test case
liweitian Aug 19, 2020
9361a94
fix unit tests
lei9444 Aug 19, 2020
1f7b404
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
lei9444 Aug 19, 2020
15d9002
test
alanlong9278 Aug 19, 2020
babfc7e
qna-recognizer add tests (#3859)
zhixzhan Aug 19, 2020
7a54d93
add test for import modal
lei9444 Aug 19, 2020
cb88635
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
lei9444 Aug 19, 2020
fd8ecd4
add test
liweitian Aug 19, 2020
0f591e1
dialog id
alanlong9278 Aug 20, 2020
afb85d8
fix bug
liweitian Aug 20, 2020
1e9cac9
fix bug
liweitian Aug 20, 2020
4987ec4
wrong url
liweitian Aug 20, 2020
d78e5ba
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 20, 2020
1a69c33
conflict
alanlong9278 Aug 20, 2020
66db11d
Update ComposerSettingsExtensions
luhan2017 Aug 20, 2020
996441a
update the error message
lei9444 Aug 20, 2020
eaf44b4
conflict fix
alanlong9278 Aug 21, 2020
db31442
Update ComposerSettingsExtensions.cs
luhan2017 Aug 21, 2020
0fd7851
azure deploy
alanlong9278 Aug 21, 2020
7ee9a27
Merge branch 'julong/qna-recognizer-conflict' of https://github.com/m…
alanlong9278 Aug 21, 2020
beba05f
Merge branch 'julong/qna-recognizer-conflict' into qna-recognizer
alanlong9278 Aug 21, 2020
cd88ee9
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 21, 2020
f7f5fde
lu build
alanlong9278 Aug 21, 2020
85e166b
qna build bugfix
alanlong9278 Aug 21, 2020
4d17a71
code refine
liweitian Aug 22, 2020
770c837
lint fix
liweitian Aug 22, 2020
9fee141
qna name
alanlong9278 Aug 22, 2020
807b701
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
alanlong9278 Aug 22, 2020
4b05b9a
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 24, 2020
f342638
code refine
liweitian Aug 24, 2020
7e7ef38
Update package to daily to fix the CrossTrainRecognizer issue
luhan2017 Aug 24, 2020
3e4a880
concurrent import qna from urls and set call limits
liweitian Aug 24, 2020
262fa4a
error message & e2e test
alanlong9278 Aug 24, 2020
13f0dc9
e2e test
alanlong9278 Aug 24, 2020
4eafc82
code scan error
liweitian Aug 24, 2020
f07b282
fix code scanner error
liweitian Aug 24, 2020
2ca6131
fix code scanner error
liweitian Aug 24, 2020
4479d0c
update the get params
lei9444 Aug 24, 2020
a672cdd
Merge branch 'main' into qna-recognizer
alanlong9278 Aug 25, 2020
11eb6e4
fix UI
liweitian Aug 25, 2020
b62420f
update qna error logic
liweitian Aug 25, 2020
9ddec6c
Update package to 4.10.1
luhan2017 Aug 25, 2020
56fbfb5
encode qna urls
liweitian Aug 25, 2020
3a1442e
refactor
alanlong9278 Aug 25, 2020
820e27f
fix e2e todobot
liweitian Aug 25, 2020
4d3e3bf
Merge branch 'qna-recognizer' of https://github.com/microsoft/BotFram…
alanlong9278 Aug 25, 2020
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
4 changes: 2 additions & 2 deletions Composer/cypress/integration/LuisDeploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ context('Luis Deploy', () => {
cy.url().should('contain', 'language-understanding/all');
cy.route({
method: 'POST',
url: 'api/projects/*/luFiles/publish',
url: 'api/projects/*/build',
status: 200,
response: 'fixture:luPublish/success',
});
Expand All @@ -33,7 +33,7 @@ context('Luis Deploy', () => {

cy.route({
method: 'POST',
url: 'api/projects/*/luFiles/publish',
url: 'api/projects/*/build',
status: 400,
response: 'fixture:luPublish/error',
});
Expand Down
8 changes: 3 additions & 5 deletions Composer/cypress/integration/ToDoBot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
// Licensed under the MIT License.

context('ToDo Bot', () => {
beforeEach(() => {
before(() => {
cy.visit('/home');
cy.createBot('TodoSample');
cy.findByTestId('WelcomeModalCloseIcon').click();
cy.findByText('Yes').click();
});

it('can open the main dialog', () => {
Expand All @@ -19,7 +21,6 @@ context('ToDo Bot', () => {
it('can open the AddToDo dialog', () => {
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('addtodo').click();
cy.findByText('addtodo').click();
});

cy.url().should('contain', 'addtodo');
Expand All @@ -28,7 +29,6 @@ context('ToDo Bot', () => {
it('can open the ClearToDos dialog', () => {
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('cleartodos').click();
cy.findByText('cleartodos').click();
});

cy.url().should('contain', 'cleartodos');
Expand All @@ -37,7 +37,6 @@ context('ToDo Bot', () => {
it('can open the DeleteToDo dialog', () => {
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('deletetodo').click();
cy.findByText('deletetodo').click();
});

cy.url().should('contain', 'deletetodo');
Expand All @@ -46,7 +45,6 @@ context('ToDo Bot', () => {
it('can open the ShowToDos dialog', () => {
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('showtodos').click();
cy.findByText('showtodos').click();
});

cy.url().should('contain', 'showtodos');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as React from 'react';
import { fireEvent } from '@bfc/test-utils';

import { PublishLuisDialog } from '../../../src/components/TestController/publishDialog';
import { PublishDialog } from '../../../src/components/TestController/publishDialog';
import { projectIdState, botNameState, settingsState, dispatcherState } from '../../../src/recoilModel';
import { renderWithRecoil } from '../../testUtils';
jest.useFakeTimers();
Expand All @@ -18,8 +18,10 @@ const luisConfig = {
defaultLanguage: 'en-us',
environment: 'composer',
};
describe('<PublishLuisDialog />', () => {
it('should render the <PublishLuisDialog />', () => {
const config = { subscriptionKey: '12345', qnaRegion: 'westus', ...luisConfig };
const qnaConfig = { subscriptionKey: '12345', endpointKey: '12345', qnaRegion: 'westus' };
describe('<PublishDialog />', () => {
it('should render the <PublishDialog />', () => {
const onDismiss = jest.fn(() => {});
const onPublish = jest.fn(() => {});
const setSettingsMock = jest.fn(() => {});
Expand All @@ -31,16 +33,11 @@ describe('<PublishLuisDialog />', () => {
set(botNameState, 'sampleBot0');
set(settingsState, {
luis: luisConfig,
qna: qnaConfig,
});
};
const { getByText } = renderWithRecoil(
<PublishLuisDialog
isOpen
botName={'sampleBot0'}
config={luisConfig}
onDismiss={onDismiss}
onPublish={onPublish}
/>,
<PublishDialog isOpen botName={'sampleBot0'} config={config} onDismiss={onDismiss} onPublish={onPublish} />,
recoilInitState
);

Expand All @@ -50,14 +47,21 @@ describe('<PublishLuisDialog />', () => {
fireEvent.click(publishButton);
expect(onPublish).toBeCalled();
expect(onPublish).toBeCalledWith({
name: 'sampleBot0',
authoringKey: '12345',
authoringEndpoint: 'testAuthoringEndpoint',
endpointKey: '12345',
endpoint: 'testEndpoint',
authoringRegion: 'westus',
defaultLanguage: 'en-us',
environment: 'composer',
luis: {
name: 'sampleBot0',
authoringKey: '12345',
authoringEndpoint: 'testAuthoringEndpoint',
endpointKey: '12345',
endpoint: 'testEndpoint',
authoringRegion: 'westus',
defaultLanguage: 'en-us',
environment: 'composer',
},
qna: {
subscriptionKey: '12345',
endpointKey: '',
qnaRegion: 'westus',
},
});
});
});
5 changes: 5 additions & 0 deletions Composer/packages/client/__tests__/components/skill.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ const recoilInitState = ({ set }) => {
defaultLanguage: 'en-us',
environment: 'composer',
},
qna: {
subscriptionKey: '12345',
qnaRegion: 'westus',
endpointKey: '',
},
});
};

Expand Down
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();
});
});
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);
});
});
2 changes: 1 addition & 1 deletion Composer/packages/client/__tests__/plugins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('mergePluginConfigs', () => {
};

// @ts-expect-error
expect(mergePluginConfigs(config1, config2).recognizers).toEqual(['recognizer 1', 'recognizer 2']);
expect(mergePluginConfigs(config1, config2).recognizers).toEqual(['recognizer 2', 'recognizer 1']);
});

it('replaces other arrays', () => {
Expand Down
97 changes: 97 additions & 0 deletions Composer/packages/client/__tests__/shell/triggerApi.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { renderHook } from '@bfc/test-utils/lib/hooks';
import * as React from 'react';
import { RecoilRoot } from 'recoil';

import { useTriggerApi } from '../../src/shell/triggerApi';
import {
projectIdState,
localeState,
luFilesState,
lgFilesState,
dialogsState,
schemasState,
dispatcherState,
} from '../../src/recoilModel';
import { Dispatcher } from '../../src/recoilModel/dispatchers';

const state = {
dialogs: [
{
id: 'test',
content: {},
},
],
luFiles: [
{
content: 'test',
id: 'test.en-us',
intents: [],
},
],
lgFiles: [
{
content: 'test',
id: 'test.en-us',
templates: [],
},
],
schemas: { sdk: { content: {} } },
focusPath: '',
locale: 'en-us',
projectId: 'test',
};

describe('use triggerApi hooks', () => {
let selectToMock, updateDialogMock, createLgTemplatesMock, createLuIntentMock, result;
beforeEach(() => {
selectToMock = jest.fn();
updateDialogMock = jest.fn();
createLgTemplatesMock = jest.fn();
createLuIntentMock = jest.fn();

const initRecoilState = ({ set }) => {
set(projectIdState, state.projectId);
set(localeState, 'en-us');
set(luFilesState, state.luFiles);
set(lgFilesState, state.lgFiles);
set(dialogsState, state.dialogs);
set(schemasState, state.schemas);
set(dispatcherState, (current: Dispatcher) => ({
...current,
selectTo: selectToMock,
updateDialog: updateDialogMock,
createLgTemplates: createLgTemplatesMock,
createLuIntent: createLuIntentMock,
}));
};

const wrapper = (props: { children?: React.ReactNode }) => {
const { children } = props;
return <RecoilRoot initializeState={initRecoilState}>{children}</RecoilRoot>;
};
const rendered = renderHook(() => useTriggerApi(), {
wrapper,
});
result = rendered.result;
});

it('should create QnA trigger', async () => {
const dialogId = 'test';
const formData = {
$kind: 'Microsoft.OnQnAMatch',
errors: { $kind: '', intent: '', event: '', triggerPhrases: '', regEx: '', activity: '' },
event: '',
intent: '',
regEx: '',
triggerPhrases: '',
};
await result.current.createTrigger(dialogId, formData);
expect(createLgTemplatesMock).toBeCalledTimes(1);
expect(updateDialogMock).toBeCalledTimes(1);
expect(createLgTemplatesMock).toBeCalledTimes(1);
expect(updateDialogMock).toBeCalledTimes(1);
});
});
2 changes: 2 additions & 0 deletions Composer/packages/client/__tests__/utils/dialogUtil.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,11 @@ describe('getTriggerTypes', () => {
const triggerTypes = getTriggerTypes();
expect(triggerTypes).toEqual([
{ key: 'Microsoft.OnIntent', text: 'Intent recognized' },
{ key: 'Microsoft.OnQnAMatch', text: 'QnA Intent recognized' },
{ key: 'Microsoft.OnUnknownIntent', text: 'Unknown intent' },
{ key: 'Microsoft.OnDialogEvent', text: 'Dialog events' },
{ key: 'Microsoft.OnActivity', text: 'Activities' },
{ key: 'Microsoft.OnChooseIntent', text: 'Duplicated intents recognized' },
{ key: 'OnCustomEvent', text: 'Custom events' },
]);
});
Expand Down
Loading