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
bcff2d94
Commit
bcff2d94
authored
Feb 09, 2022
by
Mark Florian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove setImmediate usage in specs
Part of
https://gitlab.com/gitlab-org/gitlab/-/issues/344247
.
parent
26138b35
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
70 deletions
+43
-70
spec/frontend/error_tracking/components/error_details_spec.js
.../frontend/error_tracking/components/error_details_spec.js
+12
-20
spec/frontend/error_tracking/components/error_tracking_list_spec.js
...end/error_tracking/components/error_tracking_list_spec.js
+5
-5
spec/frontend/feature_flags/components/feature_flags_spec.js
spec/frontend/feature_flags/components/feature_flags_spec.js
+10
-10
spec/frontend/filtered_search/filtered_search_visual_tokens_spec.js
...end/filtered_search/filtered_search_visual_tokens_spec.js
+4
-5
spec/frontend/flash_spec.js
spec/frontend/flash_spec.js
+2
-6
spec/frontend/gl_form_spec.js
spec/frontend/gl_form_spec.js
+2
-13
spec/frontend/ide/components/commit_sidebar/list_item_spec.js
.../frontend/ide/components/commit_sidebar/list_item_spec.js
+8
-11
No files found.
spec/frontend/error_tracking/components/error_details_spec.js
View file @
bcff2d94
...
...
@@ -583,33 +583,25 @@ describe('ErrorDetails', () => {
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
category
,
action
);
});
it
(
'
should track IGNORE status update
'
,
()
=>
{
it
(
'
should track IGNORE status update
'
,
async
()
=>
{
Tracking
.
event
.
mockClear
();
findUpdateIgnoreStatusButton
().
vm
.
$emit
(
'
click
'
);
setImmediate
(()
=>
{
const
{
category
,
action
}
=
trackErrorStatusUpdateOptions
(
'
ignored
'
);
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
category
,
action
);
});
await
findUpdateIgnoreStatusButton
().
trigger
(
'
click
'
);
const
{
category
,
action
}
=
trackErrorStatusUpdateOptions
(
'
ignored
'
);
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
category
,
action
);
});
it
(
'
should track RESOLVE status update
'
,
()
=>
{
it
(
'
should track RESOLVE status update
'
,
async
()
=>
{
Tracking
.
event
.
mockClear
();
findUpdateResolveStatusButton
().
vm
.
$emit
(
'
click
'
);
setImmediate
(()
=>
{
const
{
category
,
action
}
=
trackErrorStatusUpdateOptions
(
'
resolved
'
);
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
category
,
action
);
});
await
findUpdateResolveStatusButton
().
trigger
(
'
click
'
);
const
{
category
,
action
}
=
trackErrorStatusUpdateOptions
(
'
resolved
'
);
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
category
,
action
);
});
it
(
'
should track external Sentry link views
'
,
()
=>
{
it
(
'
should track external Sentry link views
'
,
async
()
=>
{
Tracking
.
event
.
mockClear
();
findExternalUrl
().
trigger
(
'
click
'
);
setImmediate
(()
=>
{
const
{
category
,
action
,
label
,
property
}
=
trackClickErrorLinkToSentryOptions
(
externalUrl
,
);
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
category
,
action
,
{
label
,
property
});
});
await
findExternalUrl
().
trigger
(
'
click
'
);
const
{
category
,
action
,
label
,
property
}
=
trackClickErrorLinkToSentryOptions
(
externalUrl
);
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
category
,
action
,
{
label
,
property
});
});
});
});
spec/frontend/error_tracking/components/error_tracking_list_spec.js
View file @
bcff2d94
...
...
@@ -447,7 +447,7 @@ describe('ErrorTrackingList', () => {
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
category
,
action
);
});
it
(
'
should track status updates
'
,
()
=>
{
it
(
'
should track status updates
'
,
async
()
=>
{
Tracking
.
event
.
mockClear
();
const
status
=
'
ignored
'
;
findErrorActions
().
vm
.
$emit
(
'
update-issue-status
'
,
{
...
...
@@ -455,10 +455,10 @@ describe('ErrorTrackingList', () => {
status
,
});
setImmediate
(()
=>
{
const
{
category
,
action
}
=
trackErrorStatusUpdateOptions
(
status
);
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
category
,
action
);
}
);
await
nextTick
();
const
{
category
,
action
}
=
trackErrorStatusUpdateOptions
(
status
);
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
category
,
action
);
});
});
});
spec/frontend/feature_flags/components/feature_flags_spec.js
View file @
bcff2d94
...
...
@@ -71,12 +71,12 @@ describe('Feature flags', () => {
describe
(
'
when limit exceeded
'
,
()
=>
{
const
provideData
=
{
...
mockData
,
featureFlagsLimitExceeded
:
true
};
beforeEach
((
done
)
=>
{
beforeEach
(()
=>
{
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
,
{
params
:
{
page
:
'
1
'
}
})
.
reply
(
200
,
getRequestData
,
{});
factory
(
provideData
);
setImmediate
(
done
);
return
waitForPromises
(
);
});
it
(
'
makes the new feature flag button do nothing if clicked
'
,
()
=>
{
...
...
@@ -116,12 +116,12 @@ describe('Feature flags', () => {
userListPath
:
null
,
};
beforeEach
((
done
)
=>
{
beforeEach
(()
=>
{
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
,
{
params
:
{
page
:
'
1
'
}
})
.
reply
(
200
,
getRequestData
,
{});
factory
(
provideData
);
setImmediate
(
done
);
return
waitForPromises
(
);
});
it
(
'
does not render configure button
'
,
()
=>
{
...
...
@@ -202,7 +202,7 @@ describe('Feature flags', () => {
});
describe
(
'
with paginated feature flags
'
,
()
=>
{
beforeEach
((
done
)
=>
{
beforeEach
(()
=>
{
mock
.
onGet
(
mockState
.
endpoint
,
{
params
:
{
page
:
'
1
'
}
}).
replyOnce
(
200
,
getRequestData
,
{
'
x-next-page
'
:
'
2
'
,
'
x-page
'
:
'
1
'
,
...
...
@@ -214,7 +214,7 @@ describe('Feature flags', () => {
factory
();
jest
.
spyOn
(
store
,
'
dispatch
'
);
setImmediate
(
done
);
return
waitForPromises
(
);
});
it
(
'
should render a table with feature flags
'
,
()
=>
{
...
...
@@ -270,11 +270,11 @@ describe('Feature flags', () => {
});
describe
(
'
unsuccessful request
'
,
()
=>
{
beforeEach
((
done
)
=>
{
beforeEach
(()
=>
{
mock
.
onGet
(
mockState
.
endpoint
,
{
params
:
{
page
:
'
1
'
}
}).
replyOnce
(
500
,
{});
factory
();
setImmediate
(
done
);
return
waitForPromises
(
);
});
it
(
'
should render error state
'
,
()
=>
{
...
...
@@ -300,12 +300,12 @@ describe('Feature flags', () => {
});
describe
(
'
rotate instance id
'
,
()
=>
{
beforeEach
((
done
)
=>
{
beforeEach
(()
=>
{
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
,
{
params
:
{
page
:
'
1
'
}
})
.
reply
(
200
,
getRequestData
,
{});
factory
();
setImmediate
(
done
);
return
waitForPromises
(
);
});
it
(
'
should fire the rotate action when a `token` event is received
'
,
()
=>
{
...
...
spec/frontend/filtered_search/filtered_search_visual_tokens_spec.js
View file @
bcff2d94
import
axios
from
'
axios
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
FilteredSearchSpecHelper
from
'
helpers/filtered_search_spec_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
FilteredSearchVisualTokens
from
'
~/filtered_search/filtered_search_visual_tokens
'
;
describe
(
'
Filtered Search Visual Tokens
'
,
()
=>
{
...
...
@@ -715,18 +716,16 @@ describe('Filtered Search Visual Tokens', () => {
`
);
});
it
(
'
renders a author token value element
'
,
()
=>
{
it
(
'
renders a author token value element
'
,
async
()
=>
{
const
{
tokenNameElement
,
tokenValueElement
}
=
findElements
(
authorToken
);
const
tokenName
=
tokenNameElement
.
textContent
;
const
tokenValue
=
'
new value
'
;
subject
.
renderVisualTokenValue
(
authorToken
,
tokenName
,
tokenValue
);
jest
.
runOnlyPendingTimer
s
();
await
waitForPromise
s
();
setImmediate
(()
=>
{
expect
(
tokenValueElement
.
textContent
).
toBe
(
tokenValue
);
});
expect
(
tokenValueElement
.
textContent
).
toBe
(
tokenValue
);
});
});
});
spec/frontend/flash_spec.js
View file @
bcff2d94
...
...
@@ -517,16 +517,12 @@ describe('Flash', () => {
`
;
});
it
(
'
removes global flash on click
'
,
(
done
)
=>
{
it
(
'
removes global flash on click
'
,
()
=>
{
addDismissFlashClickListener
(
el
,
false
);
el
.
querySelector
(
'
.js-close-icon
'
).
click
();
setImmediate
(()
=>
{
expect
(
document
.
querySelector
(
'
.flash
'
)).
toBeNull
();
done
();
});
expect
(
document
.
querySelector
(
'
.flash
'
)).
toBeNull
();
});
});
...
...
spec/frontend/gl_form_spec.js
View file @
bcff2d94
...
...
@@ -8,7 +8,7 @@ describe('GLForm', () => {
const
testContext
=
{};
describe
(
'
when instantiated
'
,
()
=>
{
beforeEach
((
done
)
=>
{
beforeEach
(()
=>
{
window
.
gl
=
window
.
gl
||
{};
testContext
.
form
=
$
(
'
<form class="gfm-form"><textarea class="js-gfm-input"></form>
'
);
...
...
@@ -18,22 +18,11 @@ describe('GLForm', () => {
jest
.
spyOn
(
$
.
prototype
,
'
css
'
).
mockImplementation
(()
=>
{});
testContext
.
glForm
=
new
GLForm
(
testContext
.
form
,
false
);
setImmediate
(()
=>
{
$
.
prototype
.
off
.
mockClear
();
$
.
prototype
.
on
.
mockClear
();
$
.
prototype
.
css
.
mockClear
();
done
();
});
});
describe
(
'
setupAutosize
'
,
()
=>
{
beforeEach
((
done
)
=>
{
beforeEach
(()
=>
{
testContext
.
glForm
.
setupAutosize
();
setImmediate
(()
=>
{
done
();
});
});
it
(
'
should register an autosize event handler on the textarea
'
,
()
=>
{
...
...
spec/frontend/ide/components/commit_sidebar/list_item_spec.js
View file @
bcff2d94
import
Vue
,
{
nextTick
}
from
'
vue
'
;
import
{
trimText
}
from
'
helpers/text_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
{
createComponentWithStore
}
from
'
helpers/vue_mount_component_helper
'
;
import
listItem
from
'
~/ide/components/commit_sidebar/list_item.vue
'
;
import
{
createRouter
}
from
'
~/ide/ide_router
'
;
...
...
@@ -55,32 +56,28 @@ describe('Multi-file editor commit sidebar list item', () => {
expect
(
findPathText
()).
toEqual
(
f
.
name
);
});
it
(
'
opens a closed file in the editor when clicking the file path
'
,
(
done
)
=>
{
it
(
'
opens a closed file in the editor when clicking the file path
'
,
async
(
)
=>
{
jest
.
spyOn
(
vm
,
'
openPendingTab
'
);
jest
.
spyOn
(
router
,
'
push
'
).
mockImplementation
(()
=>
{});
findPathEl
.
click
();
setImmediate
(()
=>
{
expect
(
vm
.
openPendingTab
).
toHaveBeenCalled
();
expect
(
router
.
push
).
toHaveBeenCalled
();
await
nextTick
();
done
();
}
);
expect
(
vm
.
openPendingTab
).
toHaveBeenCalled
();
expect
(
router
.
push
).
toHaveBeenCalled
(
);
});
it
(
'
calls updateViewer with diff when clicking file
'
,
(
done
)
=>
{
it
(
'
calls updateViewer with diff when clicking file
'
,
async
(
)
=>
{
jest
.
spyOn
(
vm
,
'
openFileInEditor
'
);
jest
.
spyOn
(
vm
,
'
updateViewer
'
);
jest
.
spyOn
(
router
,
'
push
'
).
mockImplementation
(()
=>
{});
findPathEl
.
click
();
setImmediate
(()
=>
{
expect
(
vm
.
updateViewer
).
toHaveBeenCalledWith
(
'
diff
'
);
await
waitForPromises
();
done
();
});
expect
(
vm
.
updateViewer
).
toHaveBeenCalledWith
(
'
diff
'
);
});
describe
(
'
computed
'
,
()
=>
{
...
...
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