mirror of
https://github.com/apache/superset.git
synced 2026-04-20 08:34:37 +00:00
committed by
GitHub
parent
4d04565c9a
commit
20503f92ae
@@ -43,6 +43,7 @@ const dashboardCreatedByEndpoint =
|
||||
const dashboardFavoriteStatusEndpoint =
|
||||
'glob:*/api/v1/dashboard/favorite_status*';
|
||||
const dashboardsEndpoint = 'glob:*/api/v1/dashboard/?*';
|
||||
const dashboardEndpoint = 'glob:*/api/v1/dashboard/*';
|
||||
|
||||
const mockDashboards = [...new Array(3)].map((_, i) => ({
|
||||
id: i,
|
||||
@@ -54,7 +55,7 @@ const mockDashboards = [...new Array(3)].map((_, i) => ({
|
||||
published: true,
|
||||
changed_on_utc: new Date().toISOString(),
|
||||
changed_on_delta_humanized: '5 minutes ago',
|
||||
owners: [{ first_name: 'admin', last_name: 'admin_user' }],
|
||||
owners: [{ id: 1, first_name: 'admin', last_name: 'admin_user' }],
|
||||
thumbnail_url: '/thumbnail',
|
||||
}));
|
||||
|
||||
@@ -80,6 +81,10 @@ fetchMock.get(dashboardsEndpoint, {
|
||||
dashboard_count: 3,
|
||||
});
|
||||
|
||||
fetchMock.get(dashboardEndpoint, {
|
||||
result: mockDashboards[0],
|
||||
});
|
||||
|
||||
global.URL.createObjectURL = jest.fn();
|
||||
fetchMock.get('/thumbnail', { body: new Blob(), sendAsJson: false });
|
||||
|
||||
@@ -129,35 +134,40 @@ describe('DashboardList', () => {
|
||||
expect(wrapper.find(ListViewCard)).toExist();
|
||||
});
|
||||
|
||||
it('renders a table view', () => {
|
||||
it('renders a table view', async () => {
|
||||
wrapper.find('[data-test="list-view"]').first().simulate('click');
|
||||
await waitForComponentToPaint(wrapper);
|
||||
expect(wrapper.find('table')).toExist();
|
||||
});
|
||||
|
||||
it('edits', () => {
|
||||
it('edits', async () => {
|
||||
expect(wrapper.find(PropertiesModal)).not.toExist();
|
||||
wrapper.find('[data-test="edit-alt"]').first().simulate('click');
|
||||
await waitForComponentToPaint(wrapper);
|
||||
expect(wrapper.find(PropertiesModal)).toExist();
|
||||
});
|
||||
|
||||
it('card view edits', () => {
|
||||
it('card view edits', async () => {
|
||||
wrapper.find('[data-test="edit-alt"]').last().simulate('click');
|
||||
await waitForComponentToPaint(wrapper);
|
||||
expect(wrapper.find(PropertiesModal)).toExist();
|
||||
});
|
||||
|
||||
it('delete', () => {
|
||||
it('delete', async () => {
|
||||
wrapper
|
||||
.find('[data-test="dashboard-list-trash-icon"]')
|
||||
.first()
|
||||
.simulate('click');
|
||||
await waitForComponentToPaint(wrapper);
|
||||
expect(wrapper.find(ConfirmStatusChange)).toExist();
|
||||
});
|
||||
|
||||
it('card view delete', () => {
|
||||
it('card view delete', async () => {
|
||||
wrapper
|
||||
.find('[data-test="dashboard-list-trash-icon"]')
|
||||
.last()
|
||||
.simulate('click');
|
||||
await waitForComponentToPaint(wrapper);
|
||||
expect(wrapper.find(ConfirmStatusChange)).toExist();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user