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
873d6a78
Commit
873d6a78
authored
Dec 14, 2021
by
Justin Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more specs to cover all logic
Make sure badge count is rendered properly when value is null / present.
parent
33bc9b78
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
spec/frontend/integrations/overrides/components/integration_overrides_spec.js
...ations/overrides/components/integration_overrides_spec.js
+16
-0
spec/frontend/integrations/overrides/components/integration_tabs_spec.js
...ntegrations/overrides/components/integration_tabs_spec.js
+13
-1
No files found.
spec/frontend/integrations/overrides/components/integration_overrides_spec.js
View file @
873d6a78
...
...
@@ -5,6 +5,8 @@ import MockAdapter from 'axios-mock-adapter';
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
{
DEFAULT_PER_PAGE
}
from
'
~/api
'
;
import
IntegrationOverrides
from
'
~/integrations/overrides/components/integration_overrides.vue
'
;
import
IntegrationTabs
from
'
~/integrations/overrides/components/integration_tabs.vue
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
httpStatus
from
'
~/lib/utils/http_status
'
;
import
ProjectAvatar
from
'
~/vue_shared/components/project_avatar.vue
'
;
...
...
@@ -49,6 +51,7 @@ describe('IntegrationOverrides', () => {
const
findGlTable
=
()
=>
wrapper
.
findComponent
(
GlTable
);
const
findPagination
=
()
=>
wrapper
.
findComponent
(
GlPagination
);
const
findIntegrationTabs
=
()
=>
wrapper
.
findComponent
(
IntegrationTabs
);
const
findRowsAsModel
=
()
=>
findGlTable
()
.
findAllComponents
(
GlLink
)
...
...
@@ -72,6 +75,12 @@ describe('IntegrationOverrides', () => {
expect
(
table
.
exists
()).
toBe
(
true
);
expect
(
table
.
attributes
(
'
busy
'
)).
toBe
(
'
true
'
);
});
it
(
'
renders IntegrationTabs with count as `null`
'
,
()
=>
{
createComponent
();
expect
(
findIntegrationTabs
().
props
(
'
projectOverridesCount
'
)).
toBe
(
null
);
});
});
describe
(
'
when initial request is successful
'
,
()
=>
{
...
...
@@ -84,6 +93,13 @@ describe('IntegrationOverrides', () => {
expect
(
table
.
attributes
(
'
busy
'
)).
toBeFalsy
();
});
it
(
'
renders IntegrationTabs with count
'
,
async
()
=>
{
createComponent
();
await
waitForPromises
();
expect
(
findIntegrationTabs
().
props
(
'
projectOverridesCount
'
)).
toBe
(
mockOverrides
.
length
);
});
describe
(
'
table template
'
,
()
=>
{
beforeEach
(
async
()
=>
{
createComponent
({
mountFn
:
mount
});
...
...
spec/frontend/integrations/overrides/components/integration_tabs_spec.js
View file @
873d6a78
import
{
mount
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlTab
}
from
'
@gitlab/ui
'
;
import
{
Gl
Badge
,
Gl
Tab
}
from
'
@gitlab/ui
'
;
import
IntegrationTabs
from
'
~/integrations/overrides/components/integration_tabs.vue
'
;
import
{
settingsTabTitle
,
overridesTabTitle
}
from
'
~/integrations/constants
'
;
...
...
@@ -25,6 +25,7 @@ describe('IntegrationTabs', () => {
wrapper
.
destroy
();
});
const
findGlBadge
=
()
=>
wrapper
.
findComponent
(
GlBadge
);
const
findGlTab
=
()
=>
wrapper
.
findComponent
(
GlTab
);
const
findSettingsLink
=
()
=>
wrapper
.
find
(
'
a
'
);
...
...
@@ -47,6 +48,17 @@ describe('IntegrationTabs', () => {
expect
(
findGlTab
().
text
()).
toMatchInterpolatedText
(
`
${
overridesTabTitle
}
${
projectOverridesCount
}
`
,
);
expect
(
findGlBadge
().
text
()).
toBe
(
projectOverridesCount
);
});
describe
(
'
when count is `null
'
,
()
=>
{
it
(
'
renders "Projects using custom settings" tab without count
'
,
()
=>
{
createComponent
();
expect
(
findGlTab
().
exists
()).
toBe
(
true
);
expect
(
findGlTab
().
text
()).
toMatchInterpolatedText
(
overridesTabTitle
);
expect
(
findGlBadge
().
exists
()).
toBe
(
false
);
});
});
});
});
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