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
Merge requests
!305
Report frontend errors to sentry
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Report frontend errors to sentry
GREG-227-frontend-sentry
into
master
Overview
0
Commits
1
Pipelines
3
Changes
4
Merged
Andreas Ellewsen
requested to merge
GREG-227-frontend-sentry
into
master
3 years ago
Overview
0
Commits
1
Pipelines
3
Changes
3
Expand
0
0
Merge request reports
Compare
version 2
version 2
42fdcfba
3 years ago
version 1
459f9940
3 years ago
master (base)
and
latest version
latest version
8f14fe73
1 commit,
3 years ago
version 2
42fdcfba
1 commit,
3 years ago
version 1
459f9940
1 commit,
3 years ago
Show latest version
3 files
+
138
−
7
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
frontend/src/routes/guest/register/steps/register.test.tsx
+
108
−
0
Options
@@ -288,3 +288,111 @@ test('Gender not required to be set if gender field is not showing', async () =>
}
)
})
test
(
'
Guest not allowed to proceed in wizard if phone number is not valid
'
,
async
()
=>
{
const
nextHandler
=
jest
.
fn
()
const
allFeaturesOn
=
{
displayContactAtUnit
:
true
,
displayComment
:
true
,
displayContactAtUnitGuestInput
:
true
,
showGenderFieldForGuest
:
true
,
}
const
formData
:
GuestRegisterData
=
{
firstName
:
'
Test
'
,
lastName
:
'
Test2
'
,
mobilePhoneCountry
:
'
NO
'
,
mobilePhone
:
'
50
'
,
nationalIdNumber
:
''
,
passportNumber
:
'
12345678
'
,
passportNationality
:
'
NO
'
,
dateOfBirth
:
addYears
(
-
20
)(
new
Date
()),
gender
:
'
male
'
,
}
const
testData
=
getEmptyGuestData
()
testData
.
gender
=
'
male
'
const
submitMock
=
jest
.
fn
()
// Need this to be able to call on the submit-method on the form
const
reference
=
{
current
:
{
doSubmit
:
submitMock
,
},
}
render
(
<
FeatureContext
.
Provider
value
=
{
allFeaturesOn
}
>
<
LocalizationProvider
dateAdapter
=
{
AdapterDateFns
}
>
<
GuestRegisterStep
nextHandler
=
{
nextHandler
}
initialGuestData
=
{
testData
}
registerData
=
{
formData
}
ref
=
{
reference
}
/>
</
LocalizationProvider
>
</
FeatureContext
.
Provider
>
)
reference
.
current
?.
doSubmit
()
// TODO It is stupid to wait like this, but I have not found a wait-for function in jest
await
new
Promise
((
r
)
=>
setTimeout
(
r
,
500
))
expect
(
nextHandler
.
mock
.
calls
.
length
).
toBe
(
0
)
})
test
(
'
Guest allowed to proceed in wizard if data is valid
'
,
async
()
=>
{
const
nextHandler
=
jest
.
fn
()
const
allFeaturesOn
=
{
displayContactAtUnit
:
true
,
displayComment
:
true
,
displayContactAtUnitGuestInput
:
true
,
showGenderFieldForGuest
:
true
,
}
const
formData
:
GuestRegisterData
=
{
firstName
:
'
Test
'
,
lastName
:
'
Test2
'
,
mobilePhoneCountry
:
'
NO
'
,
mobilePhone
:
'
97543992
'
,
nationalIdNumber
:
''
,
passportNumber
:
'
12345678
'
,
passportNationality
:
'
NO
'
,
dateOfBirth
:
addYears
(
-
20
)(
new
Date
()),
gender
:
'
male
'
,
}
const
testData
=
getEmptyGuestData
()
testData
.
gender
=
'
male
'
const
submitMock
=
jest
.
fn
()
// Need this to be able to call on the submit-method on the form
const
reference
=
{
current
:
{
doSubmit
:
submitMock
,
},
}
render
(
<
FeatureContext
.
Provider
value
=
{
allFeaturesOn
}
>
<
LocalizationProvider
dateAdapter
=
{
AdapterDateFns
}
>
<
GuestRegisterStep
nextHandler
=
{
nextHandler
}
initialGuestData
=
{
testData
}
registerData
=
{
formData
}
ref
=
{
reference
}
/>
</
LocalizationProvider
>
</
FeatureContext
.
Provider
>
)
reference
.
current
?.
doSubmit
()
// TODO It is stupid to wait like this, but I have not found a wait-for function in jest
await
new
Promise
((
r
)
=>
setTimeout
(
r
,
500
))
expect
(
nextHandler
.
mock
.
calls
.
length
).
toBe
(
1
)
})
Loading