UNCLASSIFIED

Commit 6ca2d61c authored by hunter.congress's avatar hunter.congress
Browse files

adding updating teams teams

parents ac0325ef 89d22398
...@@ -176,12 +176,6 @@ ...@@ -176,12 +176,6 @@
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true "dev": true
}, },
"semver": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz",
"integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==",
"dev": true
},
"source-map": { "source-map": {
"version": "0.5.7", "version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
...@@ -561,16 +555,10 @@ ...@@ -561,16 +555,10 @@
} }
} }
}, },
"semver": { "lodash": {
"version": "6.3.0", "version": "4.17.21",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
},
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true "dev": true
} }
} }
...@@ -1584,6 +1572,12 @@ ...@@ -1584,6 +1572,12 @@
} }
} }
}, },
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
},
"source-map": { "source-map": {
"version": "0.5.7", "version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
...@@ -3871,6 +3865,11 @@ ...@@ -3871,6 +3865,11 @@
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
}, },
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"punycode": { "punycode": {
"version": "1.4.1", "version": "1.4.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
...@@ -13042,12 +13041,6 @@ ...@@ -13042,12 +13041,6 @@
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
}, },
"lodash.debounce": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
"integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=",
"dev": true
},
"lodash.defaultsdeep": { "lodash.defaultsdeep": {
"version": "4.6.1", "version": "4.6.1",
"resolved": "https://registry.npmjs.org/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz", "resolved": "https://registry.npmjs.org/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz",
......
...@@ -5,6 +5,4 @@ export const HTTP = axios.create({ ...@@ -5,6 +5,4 @@ export const HTTP = axios.create({
// add headers or common stuff here // add headers or common stuff here
}); });
HTTP.interceptors.response.use(function (response) { HTTP.interceptors.response.use((response) => response?.data?.result);
return response?.data?.result;
});
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,7 @@ export default {
return await HTTP.delete(`/courses/${courseId}`); return await HTTP.delete(`/courses/${courseId}`);
}, },
async addInstructor(courseId, instructor) { async addInstructor(courseId, instructor) {
return await HTTP.post(`/courses/${courseId}/instructor`, instructor); return await HTTP.post(`/courses/${courseId}/instructors`, instructor);
}, },
async addCourse(course) { async addCourse(course) {
return await HTTP.post("/courses", course); return await HTTP.post("/courses", course);
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
return await HTTP.put(`/courses/${courseId}`, course); return await HTTP.put(`/courses/${courseId}`, course);
}, },
async addStudent(courseId, student) { async addStudent(courseId, student) {
return await HTTP.post(`/courses/${courseId}/registration`, student); return await HTTP.post(`/courses/${courseId}/registrations`, student);
}, },
async addStudents(courseId, students) { async addStudents(courseId, students) {
for (const student of students) { for (const student of students) {
......
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
:disabled="!valid" :disabled="!valid"
color="primary" color="primary"
:loading="addBusy" :loading="addBusy"
@click="addClass()" @click="addCourse()"
> >
Add Class Add Class
</v-btn> </v-btn>
...@@ -197,7 +197,7 @@ export default { ...@@ -197,7 +197,7 @@ export default {
this.$emit("cancel"); this.$emit("cancel");
this.init(); this.init();
}, },
addClass() { addCourse() {
this.$emit("add", this.toAdd); this.$emit("add", this.toAdd);
this.init(); this.init();
}, },
......
...@@ -115,8 +115,6 @@ export default { ...@@ -115,8 +115,6 @@ export default {
.getComputedStyle(this.$refs.defaultSlot) .getComputedStyle(this.$refs.defaultSlot)
.getPropertyValue("font-size"); .getPropertyValue("font-size");
console.log("+++ startEditing", width, fontSize);
// set focus to the input element // set focus to the input element
this.$nextTick(() => { this.$nextTick(() => {
const editInput = this.getEditingInput(); const editInput = this.getEditingInput();
......
...@@ -89,7 +89,7 @@ export default { ...@@ -89,7 +89,7 @@ export default {
return { return {
inputRules, inputRules,
loading: true, loading: true,
initialLoad: false, initialLoad: true,
total: 0, total: 0,
footerProps: DEFAULT_FOOTER_PROPS, footerProps: DEFAULT_FOOTER_PROPS,
params: { params: {
...@@ -174,7 +174,8 @@ export default { ...@@ -174,7 +174,8 @@ export default {
this.personnel.listItems = data; this.personnel.listItems = data;
this.total = response.meta.total; this.total = response.meta.total;
} catch (error) { } catch (error) {
console.error("!teams error!", error); // TODO: no error messages to the user?!
console.error("!personnel error!", error);
} finally { } finally {
this.loading = false; this.loading = false;
this.fetchingData = false; this.fetchingData = false;
...@@ -186,6 +187,7 @@ export default { ...@@ -186,6 +187,7 @@ export default {
user.personnelType = null; user.personnelType = null;
return user; return user;
}); });
// TODO: this should be wrapped in a try/catch
await UserService.updateUserPersonnelType(selectedPersonnel); await UserService.updateUserPersonnelType(selectedPersonnel);
const removeStudentIds = this.personnel.selectedPersonnel.map( const removeStudentIds = this.personnel.selectedPersonnel.map(
({ id }) => id ({ id }) => id
...@@ -211,7 +213,7 @@ export default { ...@@ -211,7 +213,7 @@ export default {
return this.personnel.listItems; return this.personnel.listItems;
}, },
async updateUserPermissions(userData) { async updateUserPermissions(userData) {
await UserService.updateUserPermission([userData]); UserService.updateUserPermission([userData]);
}, },
}, },
watch: { watch: {
......
...@@ -5,7 +5,11 @@ ...@@ -5,7 +5,11 @@
class="background-transparent" class="background-transparent"
type="list-item@3" type="list-item@3"
> >
<v-card v-if="emptyString"> <v-card v-if="error">
<v-card-title>Something went wrong...</v-card-title>
<v-card-text>Use the refresh button in panel to try again.</v-card-text>
</v-card>
<v-card v-else-if="emptyString">
<v-card-title>You currently don't have any projects! </v-card-title> <v-card-title>You currently don't have any projects! </v-card-title>
<v-card-text <v-card-text
>Your starred GitLab projects will appear here. Go to >Your starred GitLab projects will appear here. Go to
...@@ -241,6 +245,7 @@ export default { ...@@ -241,6 +245,7 @@ export default {
data: () => ({ data: () => ({
loading: false, loading: false,
emptyString: false, emptyString: false,
error: false,
}), }),
async mounted() { async mounted() {
try { try {
...@@ -248,12 +253,8 @@ export default { ...@@ -248,12 +253,8 @@ export default {
await this.refreshProjects(); await this.refreshProjects();
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} finally {
// TODO: remove fake wait
setTimeout(() => {
this.loading = false;
}, 2000);
} }
this.loading = false;
}, },
methods: { methods: {
...mapMutations({ ...mapMutations({
...@@ -263,13 +264,18 @@ export default { ...@@ -263,13 +264,18 @@ export default {
if (this.setProjectLoading) { if (this.setProjectLoading) {
this.setProjectLoading(true); this.setProjectLoading(true);
} }
const projects = await ProjectService.getProjectsSummary(); this.error = false;
if (projects) { this.emptyString = false;
this.setProjects(projects); try {
this.emptyString = false; const projects = await ProjectService.getProjectsSummary();
} if (projects) {
if (projects.length === 0) { this.setProjects(projects);
this.emptyString = true; }
if (projects.length === 0) {
this.emptyString = true;
}
} catch (e) {
this.error = true;
} }
if (this.setProjectLoading) { if (this.setProjectLoading) {
this.setProjectLoading(false); this.setProjectLoading(false);
......
...@@ -153,7 +153,6 @@ export default { ...@@ -153,7 +153,6 @@ export default {
}, },
async query(val) { async query(val) {
try { try {
console.log("val:", val);
const newItems = await UserService.search({ q: val }); const newItems = await UserService.search({ q: val });
if (this.model) { if (this.model) {
if (Array.isArray(this.model)) { if (Array.isArray(this.model)) {
......
export const CALL_SET_USER_PREFERENCE = " user_preferences/callSetUserProjects"; export const CALL_SET_USER_PREFERENCE = "user_preferences/callSetUserProjects";
export const createDefaultPaginationParams = (options, additional = {}) => { export const createDefaultPaginationParams = (options, additional = {}) => {
const { overwrite } = additional; const { overwrite } = additional;
let sortBy = options.sortBy[0]; let sortBy = options.sortBy?.[0];
const sortDesc = options.sortDesc[0]; const sortDesc = options.sortDesc?.[0];
const page = options.page; const page = options.page;
const pageSize = options.itemsPerPage === -1 ? 500 : options.itemsPerPage; const pageSize = options.itemsPerPage === -1 ? 20 : options.itemsPerPage;
if (overwrite?.sortBy && sortBy === overwrite?.sortBy?.from) { if (overwrite?.sortBy && sortBy === overwrite?.sortBy?.from) {
sortBy = overwrite.sortBy.to; sortBy = overwrite.sortBy.to;
......
...@@ -11,23 +11,29 @@ ...@@ -11,23 +11,29 @@
/> />
<ErrorMessage /> <ErrorMessage />
<Section class="mt-6" v-if="showWelcomeMessage"> <Section class="mt-6" v-if="showWelcomeMessage">
<h4 slot="header" class="ma-0 pl-5">Welcome to Platform One</h4> <h4 slot="header" class="ma-0 pl-5 text-left">
Welcome to Platform One
</h4>
<WelcomeSummary slot="content" /> <WelcomeSummary slot="content" />
</Section> </Section>
<Section class="mt-6"> <Section class="mt-6">
<h4 slot="header" class="ma-0 pl-5">My Curriculum Schedule</h4> <h4 slot="header" class="ma-0 pl-5 text-left">
My Curriculum Schedule
</h4>
<CurriculumSchedule slot="content" /> <CurriculumSchedule slot="content" />
</Section> </Section>
<Section class="mt-6"> <Section class="mt-6">
<h4 slot="header" class="ma-0 pl-5">System Status</h4> <h4 slot="header" class="ma-0 pl-5 text-left">System Status</h4>
<SystemStatusSummary slot="content" /> <SystemStatusSummary slot="content" />
</Section> </Section>
</v-col> </v-col>
<v-col cols="12" lg="6" class="d-flex flex-column py-0 pt-lg-3"> <v-col cols="12" lg="6" class="d-flex flex-column py-0 pt-lg-3">
<Section> <Section>
<h4 slot="header" class="ma-0 pl-5">My Project Summary</h4> <h4 slot="header" class="ma-0 pl-5 text-left">
My Project Summary
</h4>
<span slot="header-right"> <span slot="header-right">
<v-tooltip top> <v-tooltip top>
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
...@@ -52,11 +58,11 @@ ...@@ -52,11 +58,11 @@
/> />
</Section> </Section>
<Section class="mt-6"> <Section class="mt-6">
<h4 slot="header" class="ma-0 pl-5">Help Desk</h4> <h4 slot="header" class="ma-0 pl-5 text-left">Help Desk</h4>
<HelpDeskSummary slot="content" /> <HelpDeskSummary slot="content" />
</Section> </Section>
<Section class="mt-6"> <Section class="mt-6">
<h4 slot="header" class="ma-0 pl-5">Tools</h4> <h4 slot="header" class="ma-0 pl-5 text-left">Tools</h4>
<ToolsSummary slot="content" /> <ToolsSummary slot="content" />
</Section> </Section>
</v-col> </v-col>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<v-row> <v-row>
<v-col cols="12" class="d-flex flex-column pb-0 pb-lg-3"> <v-col cols="12" class="d-flex flex-column pb-0 pb-lg-3">
<Section class="mt-6" hideCollapseButton> <Section class="mt-6" hideCollapseButton>
<h4 slot="header" class="ma-0 pl-5">My Projects</h4> <h4 slot="header" class="ma-0 pl-5 text-left">My Projects</h4>
<span slot="header-right"> <span slot="header-right">
<v-tooltip top> <v-tooltip top>
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<v-row class="justify-content-left"> <v-row class="justify-content-left">
<v-col cols="12" lg="4" md="6" sm="12" class="py-0 pt-lg-3"> <v-col cols="12" lg="4" md="6" sm="12" class="py-0 pt-lg-3">
<Section hideCollapseButton> <Section hideCollapseButton>
<h4 slot="header" class="mt-4 w-100"> <h4 slot="header" class="mt-4 w-100 text-left">
ABMS ADCE Party Bus Survival Guide ABMS ADCE Party Bus Survival Guide
</h4> </h4>
<div slot="content"> <div slot="content">
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<v-row> <v-row>
<v-col> <v-col>
<Section hide-collapse-button> <Section hide-collapse-button>
<h4 slot="header">Training Resources</h4> <h4 slot="header" class="text-left">Training Resources</h4>
<div slot="content" class="d-flex flex-column"> <div slot="content" class="d-flex flex-column">
<div class="text-left pl-10 link-column"> <div class="text-left pl-10 link-column">
<a <a
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
<v-row> <v-row>
<v-col> <v-col>
<Section hide-collapse-button> <Section hide-collapse-button>
<h4 slot="header">Self-Learning Videos</h4> <h4 slot="header" class="text-left">Self-Learning Videos</h4>
<div slot="content" class="d-flex flex-column"> <div slot="content" class="d-flex flex-column">
<div class="text-left pl-10 link-column"> <div class="text-left pl-10 link-column">
Kubernetes - Kubernetes -
......
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
<v-row> <v-row>
<v-col cols="12" lg="6" class="d-flex flex-column pb-0 pb-lg-3"> <v-col cols="12" lg="6" class="d-flex flex-column pb-0 pb-lg-3">
<Section> <Section>
<h4 slot="header" class="ma-0 pl-5">Launchboard Settings</h4> <h4 slot="header" class="ma-0 pl-5 text-left">
Launchboard Settings
</h4>
<LaunchboardSettings slot="content" /> <LaunchboardSettings slot="content" />
</Section> </Section>
</v-col> </v-col>
......
...@@ -229,7 +229,7 @@ import UserSelect from "@/components/UserSelect"; ...@@ -229,7 +229,7 @@ import UserSelect from "@/components/UserSelect";
import AddTeam from "@/components/AddTeam"; import AddTeam from "@/components/AddTeam";
import { defaultSnackbarTimeout } from "@/config/config"; import { defaultSnackbarTimeout } from "@/config/config";
import inputRules from "@/utils/inputRules"; import inputRules from "@/utils/inputRules";
import Roles from "@/config/user-permissions"; import Permission from "@/config/user-permissions";
export default { export default {
components: { UserSelect, AddTeam }, components: { UserSelect, AddTeam },
...@@ -281,12 +281,12 @@ export default { ...@@ -281,12 +281,12 @@ export default {
// Admin and Dojo Master don't have a team, so redirect them since // Admin and Dojo Master don't have a team, so redirect them since
// they don't have a reason to be on this page without a specific id // they don't have a reason to be on this page without a specific id
this.user = this.$store.state.user.user; this.user = this.$store.state.user.user;
if (this.user.role !== Roles.USER) { if (this.user.permission !== Permission.USER) {
console.warn("redirecting privileged user to /teams"); console.warn("redirecting privileged user to /teams");
this.$router.push("/teams"); this.$router.push("/teams");
} else { } else {
// get the current user's team // get the current user's team
this.team = await TeamService.getTeamForUser(); this.team = await TeamService.getMyTeam();
} }
} else { } else {
console.log("THIS CANNOT BE ME"); console.log("THIS CANNOT BE ME");
...@@ -410,6 +410,7 @@ export default { ...@@ -410,6 +410,7 @@ export default {
); );
this.snackbars.delete = true; this.snackbars.delete = true;
} catch (e) { } catch (e) {
// TODO: no user notification of the error???
console.error("error deleting member:", e); console.error("error deleting member:", e);
} finally { } finally {
this.deletingMembers.forEach((m) => Vue.set(m, "isDeleting", false)); this.deletingMembers.forEach((m) => Vue.set(m, "isDeleting", false));
...@@ -428,6 +429,7 @@ export default { ...@@ -428,6 +429,7 @@ export default {
this.$route.params.teamId this.$route.params.teamId
); );
} catch (e) { } catch (e) {
//TODO: error message to the user???
console.error("error restoring member:", e); console.error("error restoring member:", e);
} finally { } finally {
await this.getTeams(); await this.getTeams();
......
...@@ -363,11 +363,9 @@ export default { ...@@ -363,11 +363,9 @@ export default {
}), }),
computed: { computed: {
getSelectedPocs() { getSelectedPocs() {
console.log(this.selectedPocs);
return this.selectedPocs; return this.selectedPocs;
}, },
getSelectedStudents() { getSelectedStudents() {
console.log(this.selectedStudents);
return this.selectedStudents; return this.selectedStudents;
}, },
}, },
...@@ -376,12 +374,10 @@ export default { ...@@ -376,12 +374,10 @@ export default {
this.trainingCourse = await TrainingService.getCourse( this.trainingCourse = await TrainingService.getCourse(
this.$route.params.trainingId this.$route.params.trainingId
); );
console.log(this.trainingCourse);
this.loading = false; this.loading = false;
}, },
methods: { methods: {
removeSelectedStudent() { removeSelectedStudent() {
console.log(this.getSelectedStudents);
const removeStudentIds = this.getSelectedStudents.map( const removeStudentIds = this.getSelectedStudents.map(
(student) => student.id (student) => student.id
); );
......
...@@ -109,10 +109,10 @@ ...@@ -109,10 +109,10 @@
</v-row> </v-row>
</v-container> </v-container>
<AddClass <AddCourse
v-if="state.isAdding" v-if="state.isAdding"
@cancel="state.isAdding = false" @cancel="state.isAdding = false"
@add="addClass" @add="addCourse"
:add-busy="state.isAddingBusy" :add-busy="state.isAddingBusy"
/> />
</template> </template>
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
<script> <script>
import Vue from "vue"; import Vue from "vue";
import TrainingService from "@/api/services/training"; import TrainingService from "@/api/services/training";
import AddClass from "@/components/AddClass"; import AddCourse from "@/components/AddCourse";
import { defaultSnackbarTimeout, debounceTimeout } from "@/config/config"; import { defaultSnackbarTimeout, debounceTimeout } from "@/config/config";
import { trainingTypes } from "@/config/reference-data"; import { trainingTypes } from "@/config/reference-data";
import isEqual from "lodash/isEqual"; import isEqual from "lodash/isEqual";
...@@ -283,7 +283,7 @@ import { createDefaultPaginationParams } from "@/utils/tableHelpers"; ...@@ -283,7 +283,7 @@ import { createDefaultPaginationParams } from "@/utils/tableHelpers";
export default { export default {
components: { components: {
AddClass, AddCourse,
}, },
data: () => ({ data: () => ({
initialLoad: true, initialLoad: true,
...@@ -387,7 +387,7 @@ export default { ...@@ -387,7 +387,7 @@ export default {
} }
}, },
async addClass(toAdd) { async addCourse(toAdd) {
this.state.isAddingBusy = true; this.state.isAddingBusy = true;
toAdd.seats = { toAdd.seats = {
......
...@@ -38,6 +38,7 @@ describe("Launchboard InitialLoadingApp", () => { ...@@ -38,6 +38,7 @@ describe("Launchboard InitialLoadingApp", () => {
}, },
}, },
}, },
stubs: ["router-view"],
localVue, localVue,
vuetify, vuetify,
}); });
...@@ -58,6 +59,7 @@ describe("Launchboard InitialLoadingApp", () => { ...@@ -58,6 +59,7 @@ describe("Launchboard InitialLoadingApp", () => {
}, },
}, },
}, },
stubs: ["router-view"],
localVue, localVue,
vuetify, vuetify,
}); });
......
...@@ -41,7 +41,7 @@ describe("Launchboard InitialLoadingApp", () => { ...@@ -41,7 +41,7 @@ describe("Launchboard InitialLoadingApp", () => {
it("should show launch state", async () => { it("should show launch state", async () => {
const wrapper = shallowMount(InitialLoadingApp); const wrapper = shallowMount(InitialLoadingApp);
wrapper.vm.$commit = jest.fn();
wrapper.vm.$destroy = jest.fn(); wrapper.vm.$destroy = jest.fn();
wrapper.vm.showLaunch(); wrapper.vm.showLaunch();
......
import { HTTP } from "@/api/http-common"; import { HTTP } from "@/api/http-common";
import axios from "axios";
describe("api/services", () => { describe("api/services", () => {
describe("should call HTTP", () => { it("HTTP should be instance of axios", () => {
test("HTTP", async () => { const shouldEqualInstance = axios.create({});
const res = await HTTP.get("test"); expect(HTTP.constructor.name).toEqual(shouldEqualInstance.constructor.name);
expect(res).toEqual(undefined); });
}); it("HTTP.get should be function", () => {
expect(typeof HTTP.get).toEqual("function");
});
it("HTTP.delete should be function", () => {
expect(typeof HTTP.delete).toEqual("function");
});
it("HTTP.put should be function", () => {
expect(typeof HTTP.put).toEqual("function");
});
it("HTTP.post should be function", () => {
expect(typeof HTTP.post).toEqual("function");
});
it("should test interceptor", () => {
expect(
HTTP.interceptors.response.handlers[0].fulfilled({
data: { result: "mock result" },
})
).toEqual("mock result");
expect(
HTTP.interceptors.response.handlers[0].fulfilled({
data: {},
})
).toBeUndefined();
expect(
HTTP.interceptors.response.handlers[0].fulfilled({})
).toBeUndefined();
}); });
}); });
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment