Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
idatt2106_2024_03_frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Scrum_Team_3
idatt2106_2024_03_frontend
Merge requests
!63
Milestone components unit tests
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Milestone components unit tests
MilestoneComponentsUnitTests
into
master
Overview
0
Commits
2
Pipelines
1
Changes
3
Merged
Sverre Frogner Haugen
requested to merge
MilestoneComponentsUnitTests
into
master
1 year ago
Overview
0
Commits
2
Pipelines
1
Changes
3
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
9f7f9876
2 commits,
1 year ago
3 files
+
101
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
src/components/__tests__/ActiveMilestoneDisplay.spec.ts
0 → 100644
+
60
−
0
Options
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
describe
,
it
,
expect
,
beforeEach
}
from
'
vitest
'
import
{
createPinia
,
setActivePinia
}
from
'
pinia
'
import
ActiveMilestoneDisplay
from
'
../milestone/ActiveMilestoneDisplay.vue
'
import
ProgressBar
from
'
../ProgressBar.vue
'
describe
(
'
ActiveMilestoneDisplay
'
,
()
=>
{
beforeEach
(()
=>
{
setActivePinia
(
createPinia
())
})
const
propsData
=
{
id
:
1
,
title
:
'
Test Milestone
'
,
description
:
'
Test Description
'
,
goalSum
:
1000
,
currentSum
:
500
,
deadline
:
new
Date
(
'
2024-05-01
'
),
startDate
:
new
Date
(
'
2024-04-01
'
),
image
:
'
test.jpg
'
}
const
id
=
1
;
const
title
=
'
Test Milestone
'
const
description
=
'
Test Description
'
const
goalSum
=
1000
const
currentSum
=
500
const
deadline
=
new
Date
(
'
2024-05-01
'
)
const
startDate
=
new
Date
(
'
2024-04-01
'
)
const
image
=
'
test.jpg
'
it
(
'
renders correctly
'
,
()
=>
{
const
wrapper
=
mount
(
ActiveMilestoneDisplay
,
{
props
:
{
id
,
title
,
description
,
goalSum
,
currentSum
,
deadline
,
startDate
,
image
}
})
expect
(
wrapper
.
find
(
'
.active-milestone-display
'
).
exists
()).
toBe
(
true
)
expect
(
wrapper
.
find
(
'
.title
'
).
text
()).
toBe
(
propsData
.
title
)
expect
(
wrapper
.
find
(
'
.description
'
).
text
()).
toBe
(
`
${
propsData
.
currentSum
}
kr av
${
propsData
.
goalSum
}
kr`
)
expect
(
wrapper
.
findComponent
(
ProgressBar
).
props
(
'
Max
'
)).
toBe
(
propsData
.
goalSum
)
expect
(
wrapper
.
findComponent
(
ProgressBar
).
props
(
'
Current
'
)).
toBe
(
propsData
.
currentSum
)
})
it
(
'
displays default image if image prop is not provided
'
,
async
()
=>
{
const
wrapper
=
mount
(
ActiveMilestoneDisplay
,
{
props
:
{
propsData
}
})
await
wrapper
.
setProps
({
image
:
''
})
const
activeMilestoneDisplay
=
wrapper
.
find
(
'
.active-milestone-display
'
).
element
as
HTMLDivElement
expect
(
activeMilestoneDisplay
.
style
.
backgroundImage
).
toContain
(
'
src/assets/pig.png
'
)
})
});
Loading