Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
911e0c1e
Commit
911e0c1e
authored
Mar 08, 2020
by
Fabio Huser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate spec/javascripts/profile/ to Jest
Closes gitlab-org/gitlab#194250
parent
c901cb74
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
spec/frontend/profile/account/components/delete_account_modal_spec.js
...d/profile/account/components/delete_account_modal_spec.js
+7
-6
spec/frontend/profile/account/components/update_username_spec.js
...ontend/profile/account/components/update_username_spec.js
+5
-4
No files found.
spec/
javascripts
/profile/account/components/delete_account_modal_spec.js
→
spec/
frontend
/profile/account/components/delete_account_modal_spec.js
View file @
911e0c1e
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
deleteAccountModal
from
'
~/profile/account/components/delete_account_modal.vue
'
;
import
deleteAccountModal
from
'
~/profile/account/components/delete_account_modal.vue
'
;
describe
(
'
DeleteAccountModal component
'
,
()
=>
{
describe
(
'
DeleteAccountModal component
'
,
()
=>
{
const
actionUrl
=
`
${
gl
.
TEST_HOST
}
/delete/user`
;
const
actionUrl
=
`
${
TEST_HOST
}
/delete/user`
;
const
username
=
'
hasnoname
'
;
const
username
=
'
hasnoname
'
;
let
Component
;
let
Component
;
let
vm
;
let
vm
;
...
@@ -43,7 +44,7 @@ describe('DeleteAccountModal component', () => {
...
@@ -43,7 +44,7 @@ describe('DeleteAccountModal component', () => {
it
(
'
does not accept empty password
'
,
done
=>
{
it
(
'
does not accept empty password
'
,
done
=>
{
const
{
form
,
input
,
submitButton
}
=
findElements
();
const
{
form
,
input
,
submitButton
}
=
findElements
();
spyOn
(
form
,
'
submit
'
);
jest
.
spyOn
(
form
,
'
submit
'
).
mockImplementation
(()
=>
{}
);
input
.
value
=
''
;
input
.
value
=
''
;
input
.
dispatchEvent
(
new
Event
(
'
input
'
));
input
.
dispatchEvent
(
new
Event
(
'
input
'
));
...
@@ -61,7 +62,7 @@ describe('DeleteAccountModal component', () => {
...
@@ -61,7 +62,7 @@ describe('DeleteAccountModal component', () => {
it
(
'
submits form with password
'
,
done
=>
{
it
(
'
submits form with password
'
,
done
=>
{
const
{
form
,
input
,
submitButton
}
=
findElements
();
const
{
form
,
input
,
submitButton
}
=
findElements
();
spyOn
(
form
,
'
submit
'
);
jest
.
spyOn
(
form
,
'
submit
'
).
mockImplementation
(()
=>
{}
);
input
.
value
=
'
anything
'
;
input
.
value
=
'
anything
'
;
input
.
dispatchEvent
(
new
Event
(
'
input
'
));
input
.
dispatchEvent
(
new
Event
(
'
input
'
));
...
@@ -95,7 +96,7 @@ describe('DeleteAccountModal component', () => {
...
@@ -95,7 +96,7 @@ describe('DeleteAccountModal component', () => {
it
(
'
does not accept wrong username
'
,
done
=>
{
it
(
'
does not accept wrong username
'
,
done
=>
{
const
{
form
,
input
,
submitButton
}
=
findElements
();
const
{
form
,
input
,
submitButton
}
=
findElements
();
spyOn
(
form
,
'
submit
'
);
jest
.
spyOn
(
form
,
'
submit
'
).
mockImplementation
(()
=>
{}
);
input
.
value
=
'
this is wrong
'
;
input
.
value
=
'
this is wrong
'
;
input
.
dispatchEvent
(
new
Event
(
'
input
'
));
input
.
dispatchEvent
(
new
Event
(
'
input
'
));
...
@@ -113,7 +114,7 @@ describe('DeleteAccountModal component', () => {
...
@@ -113,7 +114,7 @@ describe('DeleteAccountModal component', () => {
it
(
'
submits form with correct username
'
,
done
=>
{
it
(
'
submits form with correct username
'
,
done
=>
{
const
{
form
,
input
,
submitButton
}
=
findElements
();
const
{
form
,
input
,
submitButton
}
=
findElements
();
spyOn
(
form
,
'
submit
'
);
jest
.
spyOn
(
form
,
'
submit
'
).
mockImplementation
(()
=>
{}
);
input
.
value
=
username
;
input
.
value
=
username
;
input
.
dispatchEvent
(
new
Event
(
'
input
'
));
input
.
dispatchEvent
(
new
Event
(
'
input
'
));
...
...
spec/
javascripts
/profile/account/components/update_username_spec.js
→
spec/
frontend
/profile/account/components/update_username_spec.js
View file @
911e0c1e
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
updateUsername
from
'
~/profile/account/components/update_username.vue
'
;
import
updateUsername
from
'
~/profile/account/components/update_username.vue
'
;
describe
(
'
UpdateUsername component
'
,
()
=>
{
describe
(
'
UpdateUsername component
'
,
()
=>
{
const
rootUrl
=
gl
.
TEST_HOST
;
const
rootUrl
=
TEST_HOST
;
const
actionUrl
=
`
${
gl
.
TEST_HOST
}
/update/username`
;
const
actionUrl
=
`
${
TEST_HOST
}
/update/username`
;
const
username
=
'
hasnoname
'
;
const
username
=
'
hasnoname
'
;
const
newUsername
=
'
new_username
'
;
const
newUsername
=
'
new_username
'
;
let
Component
;
let
Component
;
...
@@ -106,7 +107,7 @@ describe('UpdateUsername component', () => {
...
@@ -106,7 +107,7 @@ describe('UpdateUsername component', () => {
const
{
confirmModalBtn
}
=
findElements
();
const
{
confirmModalBtn
}
=
findElements
();
axiosMock
.
onPut
(
actionUrl
).
replyOnce
(()
=>
[
200
,
{
message
:
'
Username changed
'
}]);
axiosMock
.
onPut
(
actionUrl
).
replyOnce
(()
=>
[
200
,
{
message
:
'
Username changed
'
}]);
spyOn
(
axios
,
'
put
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
axios
,
'
put
'
);
vm
.
newUsername
=
newUsername
;
vm
.
newUsername
=
newUsername
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment