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
!46
Resolve "Show total savings"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Show total savings"
54-show-total-savings
into
master
Overview
0
Commits
3
Pipelines
4
Changes
3
Merged
Torbjørn Antonsen
requested to merge
54-show-total-savings
into
master
1 year ago
Overview
0
Commits
3
Pipelines
4
Changes
3
Expand
Closes
#54 (closed)
0
0
Merge request reports
Compare
master
version 2
d3fc7792
1 year ago
version 1
ce5eb780
1 year ago
master (base)
and
latest version
latest version
6aad436b
3 commits,
1 year ago
version 2
d3fc7792
2 commits,
1 year ago
version 1
ce5eb780
1 commit,
1 year ago
3 files
+
34
−
6
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__/InfoComponent.spec.ts
+
9
−
5
Options
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
InfoComponent
from
'
@/components/InfoComponent.vue
'
import
{
describe
,
it
,
expect
}
from
'
vitest
'
import
InfoComponent
from
'
@/components/InfoComponent.vue
'
;
import
{
describe
,
it
,
expect
}
from
'
vitest
'
;
//Needs to be updated when the info component gets dynamic data instead of static data
describe
(
'
InfoComponent
'
,
()
=>
{
it
(
'
renders the correct quote and total savings
'
,
()
=>
{
it
(
'
renders the correct quote and total savings
'
,
async
()
=>
{
const
wrapper
=
shallowMount
(
InfoComponent
);
// Simulate asynchronous data loading by waiting for the component to be mounted
await
wrapper
.
vm
.
$nextTick
();
const
quote
=
wrapper
.
find
(
'
#Quote
'
);
const
totalSavings
=
wrapper
.
find
(
'
#TotalSavings
'
);
expect
(
quote
.
text
()).
toBe
(
'
Sparetips: Sett av et jevnt beløp hver måned på sparekonto eller lignende.
'
);
expect
(
totalSavings
.
text
()).
toBe
(
'
Våre brukere har spart til sammen 5000 nok
'
);
// Assuming totalSavings is a number, convert it to the expected string format for assertion
const
expectedTotalSavingsText
=
`Våre brukere har spart til sammen
${(
wrapper
.
vm
as
any
).
totalSavings
}
nok`
;
expect
(
totalSavings
.
text
()).
toBe
(
expectedTotalSavingsText
);
});
});
Loading