-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 'Manage' tab to Digital Twins page preview #957
Changes from 1 commit
09ada15
cb4de3b
5e9edaa
32a9914
912a9f1
4818067
42299ae
c2773a8
42a714a
939e621
d75e747
d7ee4cc
413d396
4828566
a62b347
d957fbf
bae8bb7
fe2182f
5c12f3f
517ad1b
621775b
daebb10
78335aa
5ee7d39
c6a7644
dd7cc86
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,14 +8,14 @@ import setupStore from './utils'; | |
jest.useFakeTimers(); | ||
|
||
describe('DeleteDialog', () => { | ||
let store: ReturnType<typeof setupStore>; | ||
let storeDelete: ReturnType<typeof setupStore>; | ||
|
||
beforeEach(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 3 locations. Consider refactoring. |
||
store = setupStore(); | ||
storeDelete = setupStore(); | ||
|
||
React.act(() => { | ||
render( | ||
<Provider store={store}> | ||
<Provider store={storeDelete}> | ||
<AssetBoard tab="Manage" error={null} /> | ||
</Provider>, | ||
); | ||
|
@@ -77,7 +77,7 @@ describe('DeleteDialog', () => { | |
}); | ||
|
||
await waitFor(() => { | ||
const state = store.getState(); | ||
const state = storeDelete.getState(); | ||
expect(state.snackbar.open).toBe(true); | ||
expect(state.snackbar.message).toBe('Asset 1 deleted successfully'); | ||
expect(state.snackbar.severity).toBe('success'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,14 @@ jest.mock('react-redux', () => ({ | |
jest.useFakeTimers(); | ||
|
||
describe('DetailsDialog', () => { | ||
let store: ReturnType<typeof setupStore>; | ||
let storeDetails: ReturnType<typeof setupStore>; | ||
|
||
beforeEach(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 3 locations. Consider refactoring. |
||
store = setupStore(); | ||
storeDetails = setupStore(); | ||
|
||
React.act(() => { | ||
render( | ||
<Provider store={store}> | ||
<Provider store={storeDetails}> | ||
<AssetBoard tab="Manage" error={null} /> | ||
</Provider>, | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,18 @@ describe('Sidebar', () => { | |
const setFileContent = jest.fn(); | ||
const setFileType = jest.fn(); | ||
|
||
const clickFile = async (fileType: string, expectedFileName: string) => { | ||
const fileNode = screen.getByText(fileType); | ||
fireEvent.click(fileNode); | ||
|
||
await waitFor(() => { | ||
expect(screen.getByText(expectedFileName)).toBeInTheDocument(); | ||
}); | ||
|
||
const file = screen.getByText(expectedFileName); | ||
fireEvent.click(file); | ||
}; | ||
|
||
beforeEach(async () => { | ||
(useSelector as jest.Mock).mockImplementation( | ||
(selector: (state: RootState) => unknown) => { | ||
|
@@ -131,39 +143,15 @@ describe('Sidebar', () => { | |
}); | ||
|
||
it('calls handleFileClick when a description file is clicked', async () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 3 locations. Consider refactoring. |
||
const descriptionNode = screen.getByText('Description'); | ||
fireEvent.click(descriptionNode); | ||
|
||
await waitFor(() => { | ||
expect(screen.getByText('descriptionFile')).toBeInTheDocument(); | ||
}); | ||
|
||
const file = screen.getByText('descriptionFile'); | ||
fireEvent.click(file); | ||
await clickFile('Description', 'descriptionFile'); | ||
}); | ||
|
||
it('calls handleFileClick when a config file is clicked', async () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 3 locations. Consider refactoring. |
||
const configurationNode = screen.getByText('Configuration'); | ||
fireEvent.click(configurationNode); | ||
|
||
await waitFor(() => { | ||
expect(screen.getByText('configFile')).toBeInTheDocument(); | ||
}); | ||
|
||
const file = screen.getByText('configFile'); | ||
fireEvent.click(file); | ||
await clickFile('Configuration', 'configFile'); | ||
}); | ||
|
||
it('calls handleFileClick when a lifecycle file is clicked', async () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 3 locations. Consider refactoring. |
||
const lifecycleNode = screen.getByText('Lifecycle'); | ||
fireEvent.click(lifecycleNode); | ||
|
||
await waitFor(() => { | ||
expect(screen.getByText('lifecycleFile')).toBeInTheDocument(); | ||
}); | ||
|
||
const file = screen.getByText('lifecycleFile'); | ||
fireEvent.click(file); | ||
await clickFile('Lifecycle', 'lifecycleFile'); | ||
}); | ||
|
||
it('call setFileContent with error message if file content is null', async () => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 3 locations. Consider refactoring.