Skip to content

Commit

Permalink
fix: dashboard tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxFrank13 committed Feb 20, 2025
1 parent 764771a commit f630bf3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/containers/Dashboard/__snapshots__/index.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Dashboard snapshots courses loaded, show select session modal, no available dashboards snapshot 1`] = `
exports[`Dashboard snapshots courses loaded, show select session modal snapshot 1`] = `
<div
className="d-flex flex-column p-2 pt-0"
id="dashboard-container"
Expand All @@ -11,6 +11,7 @@ exports[`Dashboard snapshots courses loaded, show select session modal, no avail
test-page-title
</h1>
<Fragment>
<DashboardModalSlot />
<SelectSessionModal />
</Fragment>
<div
Expand Down Expand Up @@ -43,7 +44,7 @@ exports[`Dashboard snapshots courses still loading snapshot 1`] = `
</div>
`;

exports[`Dashboard snapshots there are no courses, there ARE available dashboards snapshot 1`] = `
exports[`Dashboard snapshots there are no courses snapshot 1`] = `
<div
className="d-flex flex-column p-2 pt-0"
id="dashboard-container"
Expand All @@ -54,7 +55,7 @@ exports[`Dashboard snapshots there are no courses, there ARE available dashboard
test-page-title
</h1>
<Fragment>
<DashboardModal />
<DashboardModalSlot />
</Fragment>
<div
data-testid="dashboard-content"
Expand Down
12 changes: 6 additions & 6 deletions src/containers/Dashboard/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('Dashboard', () => {
const testView = ({
props,
content: [contentName, contentEl],
showEnterpriseModal,
showDashboardModalSlot,
showSelectSessionModal,
}) => {
beforeEach(() => { wrapper = createWrapper(props); });
Expand All @@ -77,9 +77,9 @@ describe('Dashboard', () => {
it(`renders ${contentName}`, () => {
testContent(contentEl);
});
it(`${renderString(showEnterpriseModal)} dashboard modal`, () => {
it(`${renderString(showDashboardModalSlot)} dashboard modal`, () => {
expect(wrapper.instance.findByType(DashboardModalSlot).length)
.toEqual(showEnterpriseModal ? 1 : 0);
.toEqual(showDashboardModalSlot ? 1 : 0);
});
it(`${renderString(showSelectSessionModal)} select session modal`, () => {
expect(wrapper.instance.findByType(SelectSessionModal).length).toEqual(showSelectSessionModal ? 1 : 0);
Expand All @@ -93,7 +93,7 @@ describe('Dashboard', () => {
showSelectSessionModal: false,
},
content: ['LoadingView', <LoadingView />],
showEnterpriseModal: false,
showDashboardModalSlot: false,
showSelectSessionModal: false,
});
});
Expand All @@ -108,7 +108,7 @@ describe('Dashboard', () => {
content: ['LoadedView', (
<DashboardLayout><CoursesPanel /></DashboardLayout>
)],
showEnterpriseModal: false,
showDashboardModalSlot: true,
showSelectSessionModal: true,
});
});
Expand All @@ -123,7 +123,7 @@ describe('Dashboard', () => {
content: ['Dashboard layout with no courses sidebar and content', (
<DashboardLayout><CoursesPanel /></DashboardLayout>
)],
showEnterpriseModal: true,
showDashboardModalSlot: true,
showSelectSessionModal: false,
});
});
Expand Down

0 comments on commit f630bf3

Please sign in to comment.