-
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 branch 'main' into luhan/fix4651
- Loading branch information
Showing
70 changed files
with
1,021 additions
and
494 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
65 changes: 65 additions & 0 deletions
65
Composer/packages/client/__tests__/pages/design/Design.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,65 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
import React from 'react'; | ||
|
||
import { renderWithRecoil } from '../../testUtils'; | ||
import { | ||
botProjectIdsState, | ||
currentProjectIdState, | ||
dialogsSelectorFamily, | ||
schemasState, | ||
projectMetaDataState, | ||
botProjectFileState, | ||
} from '../../../src/recoilModel'; | ||
import { undoFunctionState } from '../../../src/recoilModel/undo/history'; | ||
import mockProjectResponse from '../../../src/recoilModel/dispatchers/__tests__/mocks/mockProjectResponse.json'; | ||
import DesignPage from '../../../src/pages/design/DesignPage'; | ||
import { SAMPLE_DIALOG, SAMPLE_DIALOG_2 } from '../../mocks/sampleDialog'; | ||
|
||
const projectId = '12345.6789'; | ||
const skillId = '56789.1234'; | ||
const dialogId = SAMPLE_DIALOG.id; | ||
|
||
const initRecoilState = ({ set }) => { | ||
set(currentProjectIdState, projectId); | ||
set(botProjectIdsState, [projectId]); | ||
set(dialogsSelectorFamily(projectId), [SAMPLE_DIALOG]); | ||
set(schemasState(projectId), mockProjectResponse.schemas); | ||
set(projectMetaDataState(projectId), { isRootBot: true }); | ||
set(botProjectFileState(projectId), { foo: 'bar' }); | ||
set(undoFunctionState(projectId), { canUndo: () => false, canRedo: () => false }); | ||
}; | ||
|
||
const initRecoilStateMulti = ({ set }) => { | ||
set(currentProjectIdState, projectId); | ||
set(botProjectIdsState, [projectId, skillId]); | ||
set(dialogsSelectorFamily(projectId), [SAMPLE_DIALOG]); | ||
set(dialogsSelectorFamily(skillId), [SAMPLE_DIALOG, SAMPLE_DIALOG_2]); | ||
set(schemasState(projectId), mockProjectResponse.schemas); | ||
set(schemasState(skillId), mockProjectResponse.schemas); | ||
set(projectMetaDataState(projectId), { isRootBot: true }); | ||
set(botProjectFileState(projectId), { foo: 'bar' }); | ||
set(undoFunctionState(projectId), { canUndo: () => false, canRedo: () => false }); | ||
set(undoFunctionState(skillId), { canUndo: () => false, canRedo: () => false }); | ||
}; | ||
|
||
describe('publish page', () => { | ||
it('should render the design page (no skill)', () => { | ||
const { getAllByText, getByText } = renderWithRecoil( | ||
<DesignPage dialogId={dialogId} projectId={projectId} />, | ||
initRecoilState | ||
); | ||
getAllByText(SAMPLE_DIALOG.displayName); | ||
getByText('Start Bot'); | ||
}); | ||
|
||
it('should render the design page (with skill)', () => { | ||
const { getAllByText, getByText } = renderWithRecoil( | ||
<DesignPage dialogId={dialogId} projectId={projectId} skillId={skillId} />, | ||
initRecoilStateMulti | ||
); | ||
getAllByText(SAMPLE_DIALOG.displayName); | ||
getAllByText(SAMPLE_DIALOG_2.displayName); | ||
getByText('Start Bot'); | ||
}); | ||
}); |
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.