Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
9c033d07
Commit
9c033d07
authored
1 year ago
by
Reinder Kraaij
Browse files
Options
Downloads
Patches
Plain Diff
ENhance waiting
parent
28a12bd5
No related branches found
No related tags found
1 merge request
!1189
Resolve TMSS-2810 "Skip legacy schedules"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/frontend/tmss_webapp/src/routes/Project/list.test.js
+11
-13
11 additions, 13 deletions
...TMSS/frontend/tmss_webapp/src/routes/Project/list.test.js
with
11 additions
and
13 deletions
SAS/TMSS/frontend/tmss_webapp/src/routes/Project/list.test.js
+
11
−
13
View file @
9c033d07
import
React
from
'
react
'
;
// import ReactDOM, {unmountComponentAtNode} from 'react-dom';
import
{
BrowserRouter
as
Router
}
from
'
react-router-dom
'
;
import
{
BrowserRouter
as
Router
}
from
'
react-router-dom
'
;
// import { act } from 'react-dom/test-utils';
import
{
cleanup
,
render
,
fireEvent
,
waitFor
,
act
}
from
'
@testing-library/react
'
;
import
{
cleanup
,
render
,
fireEvent
}
from
'
@testing-library/react
'
;
import
mockConsole
from
"
jest-mock-console
"
;
import
mockConsole
from
"
jest-mock-console
"
;
import
ProjectList
from
'
./list
'
;
import
ProjectList
from
'
./list
'
;
import
ProjectServiceMock
from
'
../../__mocks__/project.service.data
'
;
import
ProjectServiceMock
from
'
../../__mocks__/project.service.data
'
;
...
@@ -10,9 +7,8 @@ import ProjectService from '../../services/project.service';
...
@@ -10,9 +7,8 @@ import ProjectService from '../../services/project.service';
import
'
regenerator-runtime/runtime
'
import
'
regenerator-runtime/runtime
'
import
AuthUtil
from
'
../../utils/auth.util
'
;
import
AuthUtil
from
'
../../utils/auth.util
'
;
import
SUServiceMock
from
'
../../__mocks__/scheduleunit.service.data
'
;
import
SUServiceMock
from
'
../../__mocks__/scheduleunit.service.data
'
;
import
AuthServiceMock
from
'
../../__mocks__/auth.service.data
'
;
let
container
=
null
;
let
authSpy
,
projectListSpy
,
clusterSpy
,
fileSystemSpy
,
projectArchiveLocationSpy
,
projectStateSpy
,
rolesSpy
,
friendsSpy
,
resourceTypeSpy
;
let
authSpy
,
projectListSpy
,
clusterSpy
,
fileSystemSpy
,
projectArchiveLocationSpy
,
projectStateSpy
,
rolesSpy
,
friendsSpy
,
resourceTypeSpy
;
let
restoreConsole
;
let
restoreConsole
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
@@ -57,9 +53,6 @@ const setMockSpy = (() => {
...
@@ -57,9 +53,6 @@ const setMockSpy = (() => {
})
})
resourceTypeSpy
=
jest
.
spyOn
(
ProjectService
,
'
getResources
'
);
resourceTypeSpy
=
jest
.
spyOn
(
ProjectService
,
'
getResources
'
);
resourceTypeSpy
.
mockImplementation
(()
=>
{
resourceTypeSpy
.
mockImplementation
(()
=>
{
let
resourceType
=
{
result
:
ProjectServiceMock
.
resources
}
return
Promise
.
resolve
(
ProjectServiceMock
.
resourceType
)
return
Promise
.
resolve
(
ProjectServiceMock
.
resourceType
)
})
})
rolesSpy
=
jest
.
spyOn
(
ProjectService
,
'
getMyRoles
'
);
rolesSpy
=
jest
.
spyOn
(
ProjectService
,
'
getMyRoles
'
);
...
@@ -79,8 +72,11 @@ const clearMockSpy = (() => {
...
@@ -79,8 +72,11 @@ const clearMockSpy = (() => {
});
});
it
(
'
render project list data in table without permission to add new project, project loading status and filter
'
,
async
()
=>
{
it
(
'
render project list data in table without permission to add new project, project loading status and filter
'
,
async
()
=>
{
const
content
=
render
(
<
Router
><
ProjectList
location
=
{{
pathname
:
"
/project
"
}}
/> </
Router
>
);
let
content
;
await
new
Promise
((
r
)
=>
setTimeout
(
r
,
500
));
await
act
(
async
()
=>
{
content
=
render
(
<
Router
><
ProjectList
location
=
{{
pathname
:
"
/project
"
}}
/> </
Router
>
);
});
// Checks page title
// Checks page title
const
titleElement
=
content
.
queryByText
(
"
Project - List
"
);
const
titleElement
=
content
.
queryByText
(
"
Project - List
"
);
expect
(
titleElement
).
toBeInTheDocument
()
;
expect
(
titleElement
).
toBeInTheDocument
()
;
...
@@ -91,7 +87,8 @@ it('render project list data in table without permission to add new project, pro
...
@@ -91,7 +87,8 @@ it('render project list data in table without permission to add new project, pro
expect
(
addAction
).
toBeInTheDocument
();
expect
(
addAction
).
toBeInTheDocument
();
// Checks if view table component loaded/rendered
// Checks if view table component loaded/rendered
const
tableElement
=
content
.
queryByTestId
(
'
viewtable
'
);
const
tableElement
=
content
.
queryByTestId
(
'
viewtable
'
);
expect
(
tableElement
).
toBeInTheDocument
();
await
waitFor
(()
=>
expect
(
tableElement
).
toBeInTheDocument
());
// Checks if all mock data listed in the table with header
// Checks if all mock data listed in the table with header
expect
(
content
.
queryAllByRole
(
'
row
'
).
length
).
toBe
(
5
);
expect
(
content
.
queryAllByRole
(
'
row
'
).
length
).
toBe
(
5
);
...
@@ -113,4 +110,5 @@ it('render project list data in table without permission to add new project, pro
...
@@ -113,4 +110,5 @@ it('render project list data in table without permission to add new project, pro
expect
(
content
.
getByText
(
'
low
'
)).
toBeInTheDocument
();
expect
(
content
.
getByText
(
'
low
'
)).
toBeInTheDocument
();
expect
(
content
.
getByText
(
'
normal
'
)).
toBeInTheDocument
();
expect
(
content
.
getByText
(
'
normal
'
)).
toBeInTheDocument
();
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment