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
8dcd1e55
Commit
8dcd1e55
authored
3 years ago
by
Tore.Brede
Browse files
Options
Downloads
Patches
Plain Diff
Adding some e-mail validation tests
parent
4569fc42
No related branches found
No related tags found
1 merge request
!91
Adding some e-mail validation tests
Pipeline
#95886
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/utils/index.test.ts
+14
-1
14 additions, 1 deletion
frontend/src/utils/index.test.ts
with
14 additions
and
1 deletion
frontend/src/utils/index.test.ts
+
14
−
1
View file @
8dcd1e55
import
{
isValidMobilePhoneNumber
}
from
'
./index
'
import
{
isValidEmail
,
isValidMobilePhoneNumber
}
from
'
./index
'
// Mock i18next module to return a translation that just returns the key
// Mock i18next module to return a translation that just returns the key
jest
.
mock
(
'
i18next
'
,
()
=>
({
jest
.
mock
(
'
i18next
'
,
()
=>
({
...
@@ -12,3 +12,16 @@ test('Invalid phone number', async () => {
...
@@ -12,3 +12,16 @@ test('Invalid phone number', async () => {
test
(
'
Valid phone number
'
,
async
()
=>
{
test
(
'
Valid phone number
'
,
async
()
=>
{
expect
(
isValidMobilePhoneNumber
(
'
+47 97510000
'
)).
toEqual
(
true
)
expect
(
isValidMobilePhoneNumber
(
'
+47 97510000
'
)).
toEqual
(
true
)
})
})
test
(
'
Valid e-mail
'
,
async
()
=>
{
expect
(
isValidEmail
(
'
test@example.org
'
)).
toEqual
(
true
)
expect
(
isValidEmail
(
'
Test.Tester@example.org
'
)).
toEqual
(
true
)
})
test
(
'
Invalid e-mail
'
,
async
()
=>
{
expect
(
isValidEmail
(
'
testexample.org
'
)).
not
.
toEqual
(
true
)
expect
(
isValidEmail
(
'
test
'
)).
not
.
toEqual
(
true
)
// Treat special characters as invalid, some services allow them though
expect
(
isValidEmail
(
'
Øyvind.Åsen@example.org
'
)).
not
.
toEqual
(
true
)
expect
(
isValidEmail
(
'
Test.Tester@åsen.org
'
)).
not
.
toEqual
(
true
)
})
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