Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
greg
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
it-bott-integrasjoner
greg
Commits
908a57a3
Commit
908a57a3
authored
3 years ago
by
Tore.Brede
Browse files
Options
Downloads
Patches
Plain Diff
GREG-195: Adding a simple test for the role info screen
parent
2350e876
No related branches found
Branches containing commit
No related tags found
1 merge request
!279
GREG-195: Update end role button
Pipeline
#114963
passed
3 years ago
Stage: venv update
Stage: tests and linting
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/routes/sponsor/guest/guestRoleInfo/index.test.tsx
+68
-0
68 additions, 0 deletions
...end/src/routes/sponsor/guest/guestRoleInfo/index.test.tsx
with
68 additions
and
0 deletions
frontend/src/routes/sponsor/guest/guestRoleInfo/index.test.tsx
0 → 100644
+
68
−
0
View file @
908a57a3
import
React
from
'
react
'
import
{
render
,
screen
}
from
'
test-utils
'
import
AdapterDateFns
from
'
@mui/lab/AdapterDateFns
'
import
{
LocalizationProvider
}
from
'
@mui/lab
'
// eslint-disable-next-line import/no-extraneous-dependencies
import
{
createMemoryHistory
}
from
'
history
'
import
{
Guest
}
from
'
interfaces
'
import
parse
from
'
date-fns/parse
'
import
{
Router
}
from
'
react-router-dom
'
import
GuestRoleInfo
from
'
./index
'
import
{
waitFor
}
from
'
../../../../test-utils
'
const
guest
:
Guest
=
{
pid
:
'
100
'
,
first
:
'
Test
'
,
last
:
'
Tester
'
,
email
:
'
test@example.org
'
,
mobile
:
'
(+47)97543991
'
,
fnr
:
null
,
passport
:
null
,
feide_id
:
null
,
active
:
true
,
registered
:
true
,
verified
:
true
,
roles
:
[
{
id
:
'
200
'
,
ou_en
:
'
English organizational unit name
'
,
ou_nb
:
'
Norsk navn organisasjonsenhet
'
,
name_en
:
'
Guest role
'
,
name_nb
:
'
Gjesterolle
'
,
start_date
:
parse
(
'
2021-08-10
'
,
'
yyyy-MM-dd
'
,
new
Date
()),
end_date
:
parse
(
'
2021-08-16
'
,
'
yyyy-MM-dd
'
,
new
Date
()),
contact_person_unit
:
'
Test contact person
'
,
max_days
:
100
,
comments
:
'
Test comment
'
,
},
{
id
:
'
201
'
,
ou_en
:
'
English organizational unit name
'
,
ou_nb
:
'
Norsk navn organisasjonsenhet
'
,
name_en
:
'
Test role
'
,
name_nb
:
'
Testrolle
'
,
start_date
:
parse
(
'
2021-09-06
'
,
'
yyyy-MM-dd
'
,
new
Date
()),
end_date
:
parse
(
'
2021-09-20
'
,
'
yyyy-MM-dd
'
,
new
Date
()),
contact_person_unit
:
'
Test contact person
'
,
max_days
:
100
,
comments
:
'
Test comment
'
,
},
],
}
test
(
'
Button state correct on load
'
,
async
()
=>
{
const
history
=
createMemoryHistory
()
render
(
<
Router
history
=
{
history
}
>
<
LocalizationProvider
dateAdapter
=
{
AdapterDateFns
}
>
<
GuestRoleInfo
guest
=
{
guest
}
reloadGuest
=
{
()
=>
{}
}
/>
</
LocalizationProvider
>
</
Router
>
)
await
waitFor
(()
=>
{
expect
(
screen
.
getByText
(
'
button.save
'
)).
toBeDisabled
()
expect
(
screen
.
getByText
(
'
sponsor.endNow
'
)).
toBeEnabled
()
})
})
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