UNCLASSIFIED
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Platform One
P
Party Bus
Launchboard
launchboard-fe
Commits
364dd6fe
Commit
364dd6fe
authored
Aug 18, 2021
by
luke.glasscock
Committed by
graham.smith
Aug 18, 2021
Browse files
BULL-797: Update unit test
parent
02a57f2a
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
189 additions
and
297 deletions
+189
-297
src/scss/custom.scss
src/scss/custom.scss
+37
-7
src/store/modules/error.js
src/store/modules/error.js
+1
-2
src/views/Team.vue
src/views/Team.vue
+52
-20
src/views/super-admin/Personnel.vue
src/views/super-admin/Personnel.vue
+0
-5
src/views/super-admin/Teams.vue
src/views/super-admin/Teams.vue
+41
-4
src/views/super-admin/Training.vue
src/views/super-admin/Training.vue
+1
-11
tests/unit/api/services/status.spec.js
tests/unit/api/services/status.spec.js
+0
-12
tests/unit/components/AllCurriculumSchedule.spec.js
tests/unit/components/AllCurriculumSchedule.spec.js
+0
-39
tests/unit/components/CurriculumSchedule.spec.js
tests/unit/components/CurriculumSchedule.spec.js
+7
-2
tests/unit/components/Dialogs/DialogComponents/UserSelectForCourse.spec.js
...ents/Dialogs/DialogComponents/UserSelectForCourse.spec.js
+0
-1
tests/unit/components/InstructorCourses.spec.js
tests/unit/components/InstructorCourses.spec.js
+0
-39
tests/unit/components/RemainingSeats.spec.js
tests/unit/components/RemainingSeats.spec.js
+0
-39
tests/unit/components/SystemStatusSummary.spec.js
tests/unit/components/SystemStatusSummary.spec.js
+0
-26
tests/unit/views/admin/LaunchboardAdmin.spec.js
tests/unit/views/admin/LaunchboardAdmin.spec.js
+0
-31
tests/unit/views/super-admin/Teams.spec.js
tests/unit/views/super-admin/Teams.spec.js
+50
-59
No files found.
src/scss/custom.scss
View file @
364dd6fe
...
@@ -177,9 +177,31 @@ body {
...
@@ -177,9 +177,31 @@ body {
}
}
}
}
// custom styles for tables in mobile view
// custom styles for tables in mobile view
.theme--light
.lb-mobile-enabled
{
tr
.v-data-table__expanded__content
{
// background: #010e19;
color
:
#000000
;
a
{
&
:not
(
.primary--text
)
{
color
:
#000000
!
important
;
}
}
}
}
.theme--dark
.lb-mobile-enabled
{
tr
.v-data-table__expanded__content
{
background
:
#010e19
;
color
:
#ffffff
;
a
{
&
:not
(
.primary--text
)
{
color
:
#ffffff
!
important
;
}
}
}
}
.lb-mobile-enabled
{
.lb-mobile-enabled
{
&
.lb-mobile-no-checkbox
{
&
.lb-mobile-no-checkbox
{
::v-deep
.v-data-table__wrapper
{
.v-data-table__wrapper
{
.v-data-table__mobile-table-row
{
.v-data-table__mobile-table-row
{
>
.v-data-table__mobile-row
{
>
.v-data-table__mobile-row
{
&
:nth-child
(
1
)
{
&
:nth-child
(
1
)
{
...
@@ -193,7 +215,7 @@ body {
...
@@ -193,7 +215,7 @@ body {
}
}
}
}
}
}
::v-deep
.v-data-table__wrapper
{
.v-data-table__wrapper
{
.v-data-table__mobile-table-row
{
.v-data-table__mobile-table-row
{
display
:
flex
;
display
:
flex
;
>
.v-data-table__mobile-row
{
>
.v-data-table__mobile-row
{
...
@@ -211,15 +233,10 @@ body {
...
@@ -211,15 +233,10 @@ body {
}
}
}
}
tr
.v-data-table__expanded__content
{
tr
.v-data-table__expanded__content
{
background
:
#010e19
;
color
:
#ffffff
;
td
{
td
{
background-color
:
transparent
!
important
;
background-color
:
transparent
!
important
;
}
}
a
{
a
{
&
:not
(
.primary--text
)
{
color
:
#ffffff
!
important
;
}
&
.primary--text
{
&
.primary--text
{
color
:
var
(
--
v-primary-base
)
!
important
;
color
:
var
(
--
v-primary-base
)
!
important
;
}
}
...
@@ -451,6 +468,9 @@ body {
...
@@ -451,6 +468,9 @@ body {
background-color
:
$table-row-even-bg-light
;
background-color
:
$table-row-even-bg-light
;
}
}
table
>
tbody
>
tr
{
table
>
tbody
>
tr
{
.v-expansion-panel-header
{
background-color
:
transparent
;
}
&
:hover:not
(
.v-data-table__expanded__content
)
:not
(
.v-data-table__empty-wrapper
)
&
:hover:not
(
.v-data-table__expanded__content
)
:not
(
.v-data-table__empty-wrapper
)
td
{
td
{
background-color
:
darken
(
$table-row-odd-bg-light
,
15%
)
!
important
;
background-color
:
darken
(
$table-row-odd-bg-light
,
15%
)
!
important
;
...
@@ -513,6 +533,16 @@ body {
...
@@ -513,6 +533,16 @@ body {
}
}
.v-data-table
{
.v-data-table
{
tr
.deleting
{
opacity
:
0
.4
;
pointer-events
:
none
;
}
.v-skeleton-loader__table-row
.v-skeleton-loader__table-cell
,
.v-skeleton-loader__table-thead
.v-skeleton-loader__heading
{
&
:nth-last-child
(
-n
+
2
)
{
display
:
none
;
}
}
a
:hover:not
(
.v-btn--icon
)
{
a
:hover:not
(
.v-btn--icon
)
{
text-decoration
:
underline
;
text-decoration
:
underline
;
}
}
...
...
src/store/modules/error.js
View file @
364dd6fe
import
{
SET_ERROR_MESSAGE
}
from
"
@/store/mutation-types
"
;
import
{
SET_ERROR_MESSAGE
,
SET_ERROR_DIALOG
}
from
"
@/store/mutation-types
"
;
import
{
SET_ERROR_DIALOG
}
from
"
@/store/mutation-types
"
;
import
{
GET_ERROR_MESSAGE
}
from
"
@/store/getter-types
"
;
import
{
GET_ERROR_MESSAGE
}
from
"
@/store/getter-types
"
;
// initial state
// initial state
...
...
src/views/Team.vue
View file @
364dd6fe
...
@@ -98,15 +98,27 @@
...
@@ -98,15 +98,27 @@
<v-data-table
<v-data-table
v-else
v-else
id=
"team-table"
id=
"team-table"
:headers=
"header
s
"
:headers=
"header"
:items=
"team.members"
:items=
"team.members"
v-model=
"selectedMembers"
v-model=
"selectedMembers"
:item-class=
"itemClass"
:item-class=
"itemClass"
show-select
show-select
:options.sync=
"options"
:disable-sort=
"onMobile"
:show-expand=
"onMobile"
:expanded.sync=
"expanded"
:hide-default-header=
"onMobile"
calculate-widths
hide-default-footer
hide-default-footer
:multi-sort=
"false"
:multi-sort=
"false"
mobile-breakpoint=
"800"
:mobile-breakpoint=
"mobileBreakpoint"
class=
"background-transparent position-relative v-table-header"
expand-icon=
"mdi-chevron-right"
class=
"
lb-mobile-enabled
background-transparent
position-relative
v-table-header
"
>
>
<template
v-slot:top
>
<template
v-slot:top
>
<!--
<!--
...
@@ -234,6 +246,27 @@
...
@@ -234,6 +246,27 @@
</v-btn>
</v-btn>
</div>
</div>
</
template
>
</
template
>
<
template
v-slot:expanded-item=
"{ item }"
v-if=
"onMobile"
>
<td
class=
"text-start"
>
<div
class=
"mt-2 ml-10 mt-5 pl-4"
>
<p>
{{
item
.
role
}}
</p>
</div>
<div
class=
"mt-2 ml-10 mt-5 pl-4"
>
<a
:href=
"`mailto:$
{item.email}`">
{{
item
.
email
}}
</a>
</div>
<div
class=
"mt-2 ml-10 mt-5 pl-4"
>
<a
target=
"_blank"
rel=
"noopener"
:href=
"`https://chat.il2.dso.mil/platform-one/messages/@$
{item.username}`"
>
@
{{
item
.
username
}}
</a>
</div>
</td>
</
template
>
</v-data-table>
</v-data-table>
<v-snackbar
<v-snackbar
...
@@ -287,6 +320,7 @@ import inputRules from "@/utils/inputRules";
...
@@ -287,6 +320,7 @@ import inputRules from "@/utils/inputRules";
import
Permission
from
"
@/config/user-permissions
"
;
import
Permission
from
"
@/config/user-permissions
"
;
import
{
SET_ERROR_MESSAGE
,
SET_ERROR_DIALOG
}
from
"
@/store/mutation-types
"
;
import
{
SET_ERROR_MESSAGE
,
SET_ERROR_DIALOG
}
from
"
@/store/mutation-types
"
;
import
BaseDialog
from
"
@/components/Dialogs/BaseDialog
"
;
import
BaseDialog
from
"
@/components/Dialogs/BaseDialog
"
;
import
{
DEFAULT_TABLE_OPTIONS
}
from
"
@/config/table-constants
"
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -327,6 +361,13 @@ export default {
...
@@ -327,6 +361,13 @@ export default {
isAddingBusy
:
false
,
isAddingBusy
:
false
,
showAddToCourseDialog
:
false
,
showAddToCourseDialog
:
false
,
},
},
mobileBreakpoint
:
800
,
options
:
DEFAULT_TABLE_OPTIONS
,
expanded
:
[],
mobileHeaders
:
[
{
text
:
"
Name
"
,
value
:
"
name
"
,
width
:
"
200px
"
},
{
text
:
""
,
value
:
"
data-table-expand
"
,
align
:
"
end
"
},
],
headers
:
[
headers
:
[
{
text
:
"
Name
"
,
value
:
"
name
"
,
width
:
"
200px
"
},
{
text
:
"
Name
"
,
value
:
"
name
"
,
width
:
"
200px
"
},
{
text
:
"
Role
"
,
value
:
"
role
"
,
width
:
"
200px
"
},
{
text
:
"
Role
"
,
value
:
"
role
"
,
width
:
"
200px
"
},
...
@@ -521,16 +562,14 @@ export default {
...
@@ -521,16 +562,14 @@ export default {
return
!
isDuplicate
;
return
!
isDuplicate
;
},
},
canEdit
()
{
canEdit
()
{
// TODO: pull this from user info
return
this
.
permission
;
return
true
;
},
},
emailSelectedHref
()
{
emailSelectedHref
()
{
if
(
this
.
selectedMembers
.
length
===
0
)
{
if
(
this
.
selectedMembers
.
length
===
0
)
{
return
null
;
return
null
;
}
}
const
emails
=
this
.
selectedMembers
.
map
((
m
)
=>
m
.
email
);
const
emails
=
this
.
selectedMembers
.
map
((
m
)
=>
m
.
email
);
const
v
=
`mailto:
${
emails
.
join
(
"
,
"
)}
`
;
return
`mailto:
${
emails
.
join
(
"
,
"
)}
`
;
return
v
;
},
},
deletingMessage
()
{
deletingMessage
()
{
if
(
this
.
deletingMembers
.
length
>
1
)
{
if
(
this
.
deletingMembers
.
length
>
1
)
{
...
@@ -539,6 +578,12 @@ export default {
...
@@ -539,6 +578,12 @@ export default {
return
`
${
this
.
deletingMembers
[
0
].
name
}
removed from
${
this
.
team
.
name
}
`
;
return
`
${
this
.
deletingMembers
[
0
].
name
}
removed from
${
this
.
team
.
name
}
`
;
}
}
},
},
onMobile
()
{
return
this
.
$vuetify
.
breakpoint
.
width
<
this
.
mobileBreakpoint
;
},
header
()
{
return
this
.
onMobile
?
this
.
mobileHeaders
:
this
.
headers
;
},
},
},
};
};
</
script
>
</
script
>
...
@@ -553,18 +598,5 @@ export default {
...
@@ -553,18 +598,5 @@ export default {
margin-top
:
1px
;
margin-top
:
1px
;
}
}
}
}
tr
.deleting
{
&
,
td
.v-data-table__mobile-row
{
opacity
:
0
.5
;
pointer-events
:
none
;
}
}
.v-skeleton-loader__table-row
.v-skeleton-loader__table-cell
,
.v-skeleton-loader__table-thead
.v-skeleton-loader__heading
{
&
:nth-last-child
(
-n
+
2
)
{
display
:
none
;
}
}
}
}
</
style
>
</
style
>
src/views/super-admin/Personnel.vue
View file @
364dd6fe
...
@@ -321,9 +321,4 @@ export default {
...
@@ -321,9 +321,4 @@ export default {
}
}
}
}
}
}
tr
.v-data-table__expanded__content
{
background
:
#002743
!
important
;
box-shadow
:
none
;
color
:
white
;
}
</
style
>
</
style
>
src/views/super-admin/Teams.vue
View file @
364dd6fe
...
@@ -8,18 +8,24 @@
...
@@ -8,18 +8,24 @@
>
>
<v-data-table
<v-data-table
id=
"teams-table"
id=
"teams-table"
:headers=
"header
s
"
:headers=
"header"
:loading=
"fetchingData"
:loading=
"fetchingData"
:items=
"teams"
:items=
"teams"
v-model=
"selectedTeams"
v-model=
"selectedTeams"
:item-class=
"itemClass"
:item-class=
"itemClass"
:options.sync=
"options"
:options.sync=
"options"
:disable-sort=
"onMobile"
:show-expand=
"onMobile"
:hide-default-header=
"onMobile"
:footer-props=
"footerProps"
:footer-props=
"footerProps"
:server-items-length=
"total"
:server-items-length=
"total"
:expanded.sync=
"expanded"
calculate-widths
show-select
show-select
mobile-breakpoint=
"800"
:mobile-breakpoint=
"mobileBreakpoint"
expand-icon=
"mdi-chevron-right"
loading-text=
"Loading Teams ..."
loading-text=
"Loading Teams ..."
class=
"background-transparent position-relative"
class=
"
lb-mobile-enabled
background-transparent position-relative"
:hide-default-footer=
"teams.length === 0"
:hide-default-footer=
"teams.length === 0"
>
>
<template
v-slot:top
>
<template
v-slot:top
>
...
@@ -112,8 +118,27 @@
...
@@ -112,8 +118,27 @@
{{
item
.
endDate
}}
{{
item
.
endDate
}}
</div>
</div>
</
template
>
</
template
>
<
template
v-slot:expanded-item=
"{ item }"
v-if=
"onMobile"
>
<td
class=
"text-start"
>
<div
class=
"row"
v-for=
"lead in item.leads"
:key=
"lead.name"
>
<a
:href=
"`mailto:$
{lead.email}`"
target="_blank"
rel="noopener"
class="lead-name col-12"
>
{{
lead
.
name
}}
</a
>
<a
:href=
"`mailto:$
{lead.email}`"
target="_blank"
rel="noopener"
class="lead-name col-12"
>
{{
lead
.
email
}}
</a
>
</div>
</td>
</
template
>
</v-data-table>
</v-data-table>
<div
class=
"d-flex flex-wrap mt-5 mb-3"
>
<div
class=
"d-flex flex-wrap mt-5 mb-3"
>
<v-tooltip
top
>
<v-tooltip
top
>
<
template
v-slot:activator=
"{ on, attrs }"
>
<
template
v-slot:activator=
"{ on, attrs }"
>
...
@@ -236,6 +261,12 @@ export default {
...
@@ -236,6 +261,12 @@ export default {
isAdding
:
false
,
isAdding
:
false
,
isAddingBusy
:
false
,
isAddingBusy
:
false
,
},
},
mobileBreakpoint
:
800
,
expanded
:
[],
mobileHeaders
:
[
{
text
:
"
Name
"
,
value
:
"
name
"
,
width
:
"
200px
"
},
{
text
:
""
,
value
:
"
data-table-expand
"
,
align
:
"
end
"
},
],
headers
:
[
headers
:
[
{
text
:
"
Team
"
,
value
:
"
name
"
,
fixed
:
true
,
width
:
"
200px
"
},
{
text
:
"
Team
"
,
value
:
"
name
"
,
fixed
:
true
,
width
:
"
200px
"
},
{
text
:
"
POC
"
,
value
:
"
poc
"
,
width
:
"
200px
"
},
{
text
:
"
POC
"
,
value
:
"
poc
"
,
width
:
"
200px
"
},
...
@@ -405,6 +436,12 @@ export default {
...
@@ -405,6 +436,12 @@ export default {
return
`
${
this
.
deletingTeams
[
0
].
name
}
removed`
;
return
`
${
this
.
deletingTeams
[
0
].
name
}
removed`
;
}
}
},
},
onMobile
()
{
return
this
.
$vuetify
.
breakpoint
.
width
<
this
.
mobileBreakpoint
;
},
header
()
{
return
this
.
onMobile
?
this
.
mobileHeaders
:
this
.
headers
;
},
},
},
};
};
</
script
>
</
script
>
src/views/super-admin/Training.vue
View file @
364dd6fe
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
:disable-sort=
"onMobile"
:disable-sort=
"onMobile"
calculate-widths
calculate-widths
loading-text=
"Loading Courses..."
loading-text=
"Loading Courses..."
class=
"background-transparent position-relative
lb-mobile-enabled
"
class=
"
lb-mobile-enabled
background-transparent position-relative"
:show-expand=
"onMobile"
:show-expand=
"onMobile"
:expanded.sync=
"expanded"
:expanded.sync=
"expanded"
:hide-default-footer=
"courses.length === 0"
:hide-default-footer=
"courses.length === 0"
...
@@ -634,16 +634,6 @@ export default {
...
@@ -634,16 +634,6 @@ export default {
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
#training-table
{
#training-table
{
tr
.deleting
{
opacity
:
0
.4
;
pointer-events
:
none
;
}
.v-skeleton-loader__table-row
.v-skeleton-loader__table-cell
,
.v-skeleton-loader__table-thead
.v-skeleton-loader__heading
{
&
:nth-last-child
(
-n
+
2
)
{
display
:
none
;
}
}
.availability-bar
{
.availability-bar
{
min-width
:
120px
;
min-width
:
120px
;
width
:
120px
;
width
:
120px
;
...
...
tests/unit/api/services/status.spec.js
deleted
100644 → 0
View file @
02a57f2a
import
StatusService
from
"
../../../../src/api/services/status
"
;
import
{
HTTP
}
from
"
@/api/mock-http-common
"
;
describe
(
"
services/status
"
,
()
=>
{
describe
(
"
should call HTTP
"
,
()
=>
{
test
(
"
getStatusSummary
"
,
async
()
=>
{
HTTP
.
get
=
jest
.
fn
().
mockResolvedValue
({
test
:
"
test
"
});
await
StatusService
.
getStatusSummary
();
expect
(
HTTP
.
get
).
toHaveBeenCalled
();
});
});
});
tests/unit/components/AllCurriculumSchedule.spec.js
deleted
100644 → 0
View file @
02a57f2a
import
{
shallowMount
}
from
"
@vue/test-utils
"
;
import
TrainingService
from
"
@/api/services/training
"
;
import
AllCurriculumSchedule
from
"
@/components/AllCurriculumSchedule.vue
"
;
import
flushPromises
from
"
flush-promises
"
;
describe
(
"
AllCurriculumSchedule
"
,
()
=>
{
it
(
"
should get schedule from api
"
,
async
()
=>
{
const
mockSchedule
=
[{
name
:
"
course1
"
},
{
name
:
"
course2
"
}];
TrainingService
.
getCourses
=
jest
.
fn
()
.
mockResolvedValue
({
courses
:
mockSchedule
});
const
wrapper
=
shallowMount
(
AllCurriculumSchedule
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
true
);
await
flushPromises
();
expect
(
wrapper
.
vm
.
schedule
).
toEqual
(
mockSchedule
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
false
);
});
it
(
"
should set loading to false on error
"
,
async
()
=>
{
console
.
error
=
jest
.
fn
();
// mock console.error when expecting error messages
TrainingService
.
getCourses
=
jest
.
fn
().
mockRejectedValue
(
"
mock error
"
);
const
wrapper
=
shallowMount
(
AllCurriculumSchedule
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
true
);
await
flushPromises
();
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
false
);
});
it
(
"
should set emptyString to true
"
,
async
()
=>
{
TrainingService
.
getCourses
=
jest
.
fn
().
mockResolvedValue
({
courses
:
[]
});
const
wrapper
=
shallowMount
(
AllCurriculumSchedule
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
true
);
await
flushPromises
();
expect
(
wrapper
.
vm
.
schedule
).
toEqual
([]);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
false
);
});
});
tests/unit/components/CurriculumSchedule.spec.js
View file @
364dd6fe
...
@@ -3,6 +3,8 @@ import ScheduleService from "@/api/services/schedule";
...
@@ -3,6 +3,8 @@ import ScheduleService from "@/api/services/schedule";
import
CurriculumSchedule
from
"
@/components/CurriculumSchedule.vue
"
;
import
CurriculumSchedule
from
"
@/components/CurriculumSchedule.vue
"
;
import
{
SET_ERROR_MESSAGE
,
SET_ERROR_DIALOG
}
from
"
@/store/mutation-types
"
;
import
{
SET_ERROR_MESSAGE
,
SET_ERROR_DIALOG
}
from
"
@/store/mutation-types
"
;
import
flushPromises
from
"
flush-promises
"
;
import
flushPromises
from
"
flush-promises
"
;
import
Vuetify
from
"
vuetify
"
;
const
vuetify
=
new
Vuetify
();
describe
(
"
CurriculumSchedule
"
,
()
=>
{
describe
(
"
CurriculumSchedule
"
,
()
=>
{
const
mockSchedule
=
[
const
mockSchedule
=
[
...
@@ -16,7 +18,7 @@ describe("CurriculumSchedule", () => {
...
@@ -16,7 +18,7 @@ describe("CurriculumSchedule", () => {
.
fn
()
.
fn
()
.
mockResolvedValue
({
registrations
:
mockSchedule
});
.
mockResolvedValue
({
registrations
:
mockSchedule
});
const
wrapper
=
shallowMount
(
CurriculumSchedule
);
const
wrapper
=
shallowMount
(
CurriculumSchedule
,
{
vuetify
}
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
true
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
true
);
await
flushPromises
();
await
flushPromises
();
expect
(
wrapper
.
vm
.
registrations
).
toEqual
(
mockSchedule
);
expect
(
wrapper
.
vm
.
registrations
).
toEqual
(
mockSchedule
);
...
@@ -27,7 +29,7 @@ describe("CurriculumSchedule", () => {
...
@@ -27,7 +29,7 @@ describe("CurriculumSchedule", () => {
console
.
error
=
jest
.
fn
();
// mock console.error when expecting error messages
console
.
error
=
jest
.
fn
();
// mock console.error when expecting error messages
ScheduleService
.
getScheduleForUser
=
jest
.
fn
().
mockRejectedValue
(
mockError
);
ScheduleService
.
getScheduleForUser
=
jest
.
fn
().
mockRejectedValue
(
mockError
);
const
wrapper
=
shallowMount
(
CurriculumSchedule
);
const
wrapper
=
shallowMount
(
CurriculumSchedule
,
{
vuetify
}
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
true
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
true
);
await
flushPromises
();
await
flushPromises
();
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
false
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
false
);
...
@@ -42,6 +44,7 @@ describe("CurriculumSchedule", () => {
...
@@ -42,6 +44,7 @@ describe("CurriculumSchedule", () => {
mocks
:
{
mocks
:
{
$store
:
{
commit
:
mockCommit
},
$store
:
{
commit
:
mockCommit
},
},
},
vuetify
,
});
});
await
flushPromises
();
await
flushPromises
();
...
@@ -68,6 +71,7 @@ describe("CurriculumSchedule", () => {
...
@@ -68,6 +71,7 @@ describe("CurriculumSchedule", () => {
},
},
},
},
},
},
vuetify
,
});
});
wrapper
.
vm
.
getCertificate
(
mockCourse
);
wrapper
.
vm
.
getCertificate
(
mockCourse
);
await
flushPromises
();
await
flushPromises
();
...
@@ -100,6 +104,7 @@ describe("CurriculumSchedule", () => {
...
@@ -100,6 +104,7 @@ describe("CurriculumSchedule", () => {
},
},
},
},
},
},
vuetify
,
});
});
wrapper
.
vm
.
getCertificate
(
mockCourse
);
wrapper
.
vm
.
getCertificate
(
mockCourse
);
await
flushPromises
();
await
flushPromises
();
...
...
tests/unit/components/Dialogs/DialogComponents/UserSelectForCourse.spec.js
View file @
364dd6fe
...
@@ -66,7 +66,6 @@ describe("UserSelectForCourse", () => {
...
@@ -66,7 +66,6 @@ describe("UserSelectForCourse", () => {
});
});
expect
(
wrapper
.
vm
.
selectedMembers
).
toEqual
([]);
expect
(
wrapper
.
vm
.
selectedMembers
).
toEqual
([]);
expect
(
typeof
wrapper
.
vm
.
updateCourseMembers
).
toEqual
(
"
function
"
);
});
});
it
(
"
test forceUserSelectHint remaining seats
"
,
async
()
=>
{
it
(
"
test forceUserSelectHint remaining seats
"
,
async
()
=>
{
const
wrapper
=
shallowMount
(
UserSelectForCourse
,
{
const
wrapper
=
shallowMount
(
UserSelectForCourse
,
{
...
...
tests/unit/components/InstructorCourses.spec.js
deleted
100644 → 0
View file @
02a57f2a
import
{
shallowMount
}
from
"
@vue/test-utils
"
;
import
TrainingService
from
"
@/api/services/training
"
;
import
InstructorCourses
from
"
@/components/InstructorCourses.vue
"
;
import
flushPromises
from
"
flush-promises
"
;
describe
(
"
InstructorCourses
"
,
()
=>
{
it
(
"
should get courses from api
"
,
async
()
=>
{
const
mockSchedule
=
[{
name
:
"
course1
"
},
{
name
:
"
course2
"
}];
TrainingService
.
getCourses
=
jest
.
fn
()
.
mockResolvedValue
({
courses
:
mockSchedule
});
const
wrapper
=
shallowMount
(
InstructorCourses
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
true
);
await
flushPromises
();
expect
(
wrapper
.
vm
.
schedule
).
toEqual
(
mockSchedule
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
false
);
});
it
(
"
should set loading to false on error
"
,
async
()
=>
{
console
.
error
=
jest
.
fn
();
// mock console.error when expecting error messages
TrainingService
.
getCourses
=
jest
.
fn
().
mockRejectedValue
(
"
mock error
"
);
const
wrapper
=
shallowMount
(
InstructorCourses
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
true
);
await
flushPromises
();
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
false
);
});
it
(
"
should set emptyString to true
"
,
async
()
=>
{
TrainingService
.
getCourses
=
jest
.
fn
().
mockResolvedValue
({
courses
:
[]
});
const
wrapper
=
shallowMount
(
InstructorCourses
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
true
);
await
flushPromises
();
expect
(
wrapper
.
vm
.
schedule
).
toEqual
([]);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
false
);
});
});
tests/unit/components/RemainingSeats.spec.js
deleted
100644 → 0
View file @
02a57f2a
import
{
shallowMount
}
from
"
@vue/test-utils
"
;
import
TrainingService
from
"
@/api/services/training
"
;
import
RemainingSeats
from
"
@/components/RemainingSeats.vue
"
;
import
flushPromises
from
"
flush-promises
"
;
describe
(
"
RemainingSeats
"
,
()
=>
{
it
(
"
should get schedule from api
"
,
async
()
=>
{
const
mockSchedule
=
[{
name
:
"
course1
"
},
{
name
:
"
course2
"
}];
TrainingService
.
getCourses
=
jest
.
fn
()
.
mockResolvedValue
({
courses
:
mockSchedule
});
const
wrapper
=
shallowMount
(
RemainingSeats
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
true
);
await
flushPromises
();
expect
(
wrapper
.
vm
.
schedule
).
toEqual
(
mockSchedule
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
false
);
});
it
(
"
should set loading to false on error
"
,
async
()
=>
{
console
.
error
=
jest
.
fn
();
// mock console.error when expecting error messages
TrainingService
.
getCourses
=
jest
.
fn
().
mockRejectedValue
(
"
mock error
"
);
const
wrapper
=
shallowMount
(
RemainingSeats
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
true
);
await
flushPromises
();
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
false
);
});
it
(
"
should set emptyString to true
"
,
async
()
=>
{
TrainingService
.
getCourses
=
jest
.
fn
().
mockResolvedValue
({
courses
:
[]
});
const
wrapper
=
shallowMount
(
RemainingSeats
);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
true
);
await
flushPromises
();
expect
(
wrapper
.
vm
.
schedule
).
toEqual
([]);
expect
(
wrapper
.
vm
.
loading
).
toEqual
(
false
);
});
});
tests/unit/components/SystemStatusSummary.spec.js
deleted
100644 → 0
View file @
02a57f2a
import
Vuex
from
"
vuex
"
;
import
Vuetify
from
"
vuetify
"
;
import
{
shallowMount
,
createLocalVue
}
from
"
@vue/test-utils
"
;
import
SystemStatusSummary
from
"
@/components/SystemStatusSummary
"
;
const
vuetify
=
new
Vuetify
();
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
test
(
"
SystemStatusSummary
"
,
()
=>
{
// render the component
const
wrapper
=
shallowMount
(
SystemStatusSummary
,
{
mocks
:
{
$store
:
{
state
:
{
error
:
{},
},
},
},
localVue
,
vuetify
,
});
// assert the component loads without error
expect
(
wrapper
.
find
(
"
.error
"
).
exists
()).
toBe
(
false
);
});
tests/unit/views/admin/LaunchboardAdmin.spec.js
deleted
100644 → 0
View file @
02a57f2a
import
{
shallowMount
,
createLocalVue
}
from
"
@vue/test-utils
"
;
import
Vuex
from
"
vuex
"
;
import
LaunchboardSuperAdmin
from
"
@/views/super-admin/LaunchboardSuperAdmin.vue
"
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
describe
(
"
LaunchboardAdmin
"
,
()
=>
{
it
(
"
should get user from store
"
,
async
()
=>
{
const
wrapper
=
shallowMount
(
LaunchboardSuperAdmin
,
{
mocks
:
{
$store
:
{
state
:
{
error
:
{},
user
:
{
user
:
{
name
:
"
mock user
"
},
},
userPreferences
:
{
userPreference
:
{}
},
},
commit
:
jest
.
fn
(),
},
},
},
localVue
);
console
.
log
(
"
store
"
,
wrapper
.
vm
.
$store
);
expect
(
wrapper
.
vm
.
user
.
name
).
toEqual
(
"
mock user
"
);
});
});
tests/unit/views/super-admin/Teams.spec.js
View file @
364dd6fe
...
@@ -4,7 +4,8 @@ import TeamService from "@/api/services/team";
...
@@ -4,7 +4,8 @@ import TeamService from "@/api/services/team";
import
Vuex
from
"
vuex
"
;
import
Vuex
from
"
vuex
"
;
import
{
SET_ERROR_MESSAGE
}
from
"
@/store/mutation-types
"
;
import
{
SET_ERROR_MESSAGE
}
from
"
@/store/mutation-types
"
;
import
Vue
from
"
vue
"
;
import
Vue
from
"
vue
"
;
import
Vuetify
from
"
vuetify
"
;
const
vuetify
=
new
Vuetify
();
const
localVue
=
createLocalVue
();
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
...
@@ -16,20 +17,18 @@ describe("Teams", () => {
...
@@ -16,20 +17,18 @@ describe("Teams", () => {
TeamService
.
getTeams
=
jest
TeamService
.
getTeams
=
jest
.
fn
()
.
fn
()
.
mockResolvedValue
({
teams
:
[],
meta
:
{
total
:
0
}
});
.
mockResolvedValue
({
teams
:
[],
meta
:
{
total
:
0
}
});
const
wrapper
=
shallowMount
(
const
wrapper
=
shallowMount
(
Teams
,
{
Teams
,
mocks
:
{
{
$store
:
{
mocks
:
{
state
:
{
$store
:
{
error
:
{},
state
:
{
error
:
{},
},
commit
:
jest
.
fn
(),
},
},
commit
:
jest
.
fn
(),
},
},
},
},
localVue
localVue
,
);
vuetify
,
});
wrapper
.
vm
.
fetchDebounced
();
wrapper
.
vm
.
fetchDebounced
();
wrapper
.
vm
.
fetchDebounced
();
wrapper
.
vm
.
fetchDebounced
();
wrapper
.
vm
.
fetchDebounced
();
wrapper
.
vm
.
fetchDebounced
();
...
@@ -55,20 +54,18 @@ describe("Teams", () => {
...
@@ -55,20 +54,18 @@ describe("Teams", () => {
console
.
error
=
jest
.
fn
();
console
.
error
=
jest
.
fn
();
TeamService
.
getTeams
=
jest
.
fn
().
mockRejectedValue
(
"
mock error
"
);
TeamService
.
getTeams
=
jest
.
fn
().
mockRejectedValue
(
"
mock error
"
);
const
wrapper
=
shallowMount
(
const
wrapper
=
shallowMount
(
Teams
,
{
Teams
,
mocks
:
{
{
$store
:
{
mocks
:
{
state
:
{
$store
:
{
error
:
{},
state
:
{
error
:
{},
},
commit
:
jest
.
fn
(),
},
},
commit
:
jest
.
fn
(),
},
},
},
},
localVue
localVue
,
);
vuetify
,
});
wrapper
.
vm
.
fetchData
();
wrapper
.
vm
.
fetchData
();
// wait for debounce to trigger
// wait for debounce to trigger
...
@@ -87,20 +84,18 @@ describe("Teams", () => {
...
@@ -87,20 +84,18 @@ describe("Teams", () => {
it
(
"
should add team
"
,
async
()
=>
{
it
(
"
should add team
"
,
async
()
=>
{
TeamService
.
addTeam
=
jest
.
fn
().
mockResolvedValue
({
id
:
1
});
TeamService
.
addTeam
=
jest
.
fn
().
mockResolvedValue
({
id
:
1
});
TeamService
.
addMembers
=
jest
.
fn
().
mockResolvedValue
();
TeamService
.
addMembers
=
jest
.
fn
().
mockResolvedValue
();
const
wrapper
=
shallowMount
(
const
wrapper
=
shallowMount
(
Teams
,
{
Teams
,
mocks
:
{
{
$store
:
{
mocks
:
{
state
:
{
$store
:
{
error
:
{},
state
:
{
error
:
{},
},
commit
:
jest
.
fn
(),
},
},
commit
:
jest
.
fn
(),
},
},
},
},
localVue
localVue
,
);
vuetify
,
});
const
mockTeam
=
{
name
:
"
mock team
"
};
const
mockTeam
=
{
name
:
"
mock team
"
};
const
mockTeamMember
=
[{
name
:
"
mock member
"
}];
const
mockTeamMember
=
[{
name
:
"
mock member
"
}];
await
wrapper
.
vm
.
addTeam
(
mockTeam
,
mockTeamMember
);
await
wrapper
.
vm
.
addTeam
(
mockTeam
,
mockTeamMember
);
...
@@ -128,20 +123,18 @@ describe("Teams", () => {
...
@@ -128,20 +123,18 @@ describe("Teams", () => {
it
(
"
should remove selected teams
"
,
async
()
=>
{
it
(
"
should remove selected teams
"
,
async
()
=>
{
TeamService
.
deleteTeams
=
jest
.
fn
().
mockResolvedValue
([
1
,
2
]);
TeamService
.
deleteTeams
=
jest
.
fn
().
mockResolvedValue
([
1
,
2
]);
const
wrapper
=
shallowMount
(
const
wrapper
=
shallowMount
(
Teams
,
{
Teams
,
mocks
:
{
{
$store
:
{
mocks
:
{
state
:
{
$store
:
{
error
:
{},
state
:
{
error
:
{},
},
commit
:
jest
.
fn
(),
},
},
commit
:
jest
.
fn
(),
},
},
},
},
localVue
localVue
,
);
vuetify
,
});
const
mockTeams
=
[
const
mockTeams
=
[
{
name
:
"
mock team1
"
,
id
:
1
},
{
name
:
"
mock team1
"
,
id
:
1
},
{
name
:
"
mock team2
"
,
id
:
2
},
{
name
:
"
mock team2
"
,
id
:
2
},
...
@@ -164,14 +157,14 @@ describe("Teams", () => {
...
@@ -164,14 +157,14 @@ describe("Teams", () => {
expect
(
wrapper
.
vm
.
selectedTeams
).
toHaveLength
(
0
);
expect
(
wrapper
.
vm
.
selectedTeams
).
toHaveLength
(
0
);
});
});
it
(
"
should compute css class for teams
"
,
async
()
=>
{
it
(
"
should compute css class for teams
"
,
async
()
=>
{
const
wrapper
=
shallowMount
(
Teams
);
const
wrapper
=
shallowMount
(
Teams
,
{
vuetify
}
);
expect
(
wrapper
.
vm
.
itemClass
({})).
toEqual
([]);
expect
(
wrapper
.
vm
.
itemClass
({})).
toEqual
([]);
expect
(
wrapper
.
vm
.
itemClass
({
isDeleting
:
true
})).
toEqual
([
"
deleting
"
]);
expect
(
wrapper
.
vm
.
itemClass
({
isDeleting
:
true
})).
toEqual
([
"
deleting
"
]);
});
});
it
(
"
should compute deletingMessage
"
,
async
()
=>
{
it
(
"
should compute deletingMessage
"
,
async
()
=>
{
const
wrapper
=
shallowMount
(
Teams
);
const
wrapper
=
shallowMount
(
Teams
,
{
vuetify
}
);
wrapper
.
vm
.
deletingTeams
=
[{
name
:
"
mock team 1
"
}];
wrapper
.
vm
.
deletingTeams
=
[{
name
:
"
mock team 1
"
}];
expect
(
wrapper
.
vm
.
deletingMessage
).
toEqual
(
"
mock team 1 removed
"
);
expect
(
wrapper
.
vm
.
deletingMessage
).
toEqual
(
"
mock team 1 removed
"
);
...
@@ -184,20 +177,18 @@ describe("Teams", () => {
...
@@ -184,20 +177,18 @@ describe("Teams", () => {
expect
(
wrapper
.
vm
.
deletingMessage
).
toEqual
(
"
3 teams removed
"
);
expect
(
wrapper
.
vm
.
deletingMessage
).
toEqual
(
"
3 teams removed
"
);
});
});
it
(
"
should undo delete
"
,
async
()
=>
{
it
(
"
should undo delete
"
,
async
()
=>
{
const
wrapper
=
shallowMount
(
const
wrapper
=
shallowMount
(
Teams
,
{
Teams
,
mocks
:
{
{
$store
:
{
mocks
:
{
state
:
{
$store
:
{
error
:
{},
state
:
{
error
:
{},
},
commit
:
jest
.
fn
(),
},
},
commit
:
jest
.
fn
(),
},
},
},
},
localVue
localVue
,
);
vuetify
,
});
TeamService
.
addTeams
=
jest
.
fn
().
mockResolvedValue
();
TeamService
.
addTeams
=
jest
.
fn
().
mockResolvedValue
();
...
@@ -218,7 +209,7 @@ describe("Teams", () => {
...
@@ -218,7 +209,7 @@ describe("Teams", () => {
});
});
it
(
"
should fetch on options change
"
,
async
()
=>
{
it
(
"
should fetch on options change
"
,
async
()
=>
{
const
wrapper
=
shallowMount
(
Teams
);
const
wrapper
=
shallowMount
(
Teams
,
{
vuetify
}
);
wrapper
.
vm
.
fetchDebounced
=
jest
.
fn
();
wrapper
.
vm
.
fetchDebounced
=
jest
.
fn
();
wrapper
.
vm
.
filter
.
search
=
"
mock search
"
;
wrapper
.
vm
.
filter
.
search
=
"
mock search
"
;
...
...
Prev
1
2
Next
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