Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some final details #245

Merged
merged 2 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion frontend/src/composables/useNavigations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const main_navigations: NavigationData[] = [
{ icon: "mdi-school-outline", title: "navigation.subjects", goto: "subjects" },
{ icon: "mdi-book-check-outline", title: "navigation.projects", goto: "projects" },
{ icon: "mdi-information-outline", title: "navigation.about", goto: "about" },
{ icon: "mdi-cog-outline", title: "navigation.settings", goto: "settings" },
];

const admin_navigations: NavigationData[] = [
Expand Down
7 changes: 1 addition & 6 deletions frontend/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,6 @@ const router = createRouter({
component: () => import("../views/SubjectRegisterView.vue"),
props: (route) => ({ uuid: String(route.params.uuid) }),
},
{
path: "/settings",
name: "settings",
component: () => import("../views/SettingsView.vue"),
},
{
path: "/admin",
name: "admin",
Expand Down Expand Up @@ -205,7 +200,7 @@ router.beforeEach(async (to, from, next) => {
}

let new_next = next;
for (let middleware of middlewares) {
for (const middleware of middlewares) {
const context: MiddlewareContext = { to, from, next: new_next, router };
const { next: returned_next, final } = await middleware(context);
if (final) {
Expand Down
23 changes: 10 additions & 13 deletions frontend/src/views/ProjectsView.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<template>
<div class="projects">
<TitleContainer :title="$t('project.myProject')" class="titlecontainer">
<v-btn-toggle v-model="activeButton" class="button">
<v-btn value="finished">{{ $t("project.finished") }}</v-btn>
</v-btn-toggle>
</TitleContainer>
<h1 v-if="isLoading">{{ $t("default.loading.loading_page") }}</h1>
<h1 v-else-if="isError || noProjectsFound" class="welcome">
<h1 v-else-if="isError || noProjectsFound" class="projectInfo">
masinnae marked this conversation as resolved.
Show resolved Hide resolved
{{ $t("project.not_found") }}
</h1>
<div v-else class="projectInfo">
<TitleContainer :title="$t('project.myProject')">
<v-btn-toggle v-model="activeButton" class="button">
<v-btn value="finished">{{ $t("project.finished") }}</v-btn>
</v-btn-toggle>
</TitleContainer>
<v-divider class="divider" />
<ProjectMiniCard
v-for="project in filteredProjects"
:key="project.id"
Expand Down Expand Up @@ -54,8 +53,10 @@ const filteredProjects = computed(() => {
</script>

<style scoped>
.project-card {
margin-top: 10px;
.titlecontainer {
margin-top: 40px;
margin-left: 40px;
margin-right: 40px;
}

.projectInfo {
Expand All @@ -72,8 +73,4 @@ const filteredProjects = computed(() => {
.projects {
margin: 15px;
}

.divider {
margin-bottom: 30px;
}
</style>
3 changes: 0 additions & 3 deletions frontend/src/views/SettingsView.vue

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ describe("DeadlineItem",() => {
deadline: new Date(2024, 10, 15),
id: 1
})
},
global: {
stubs: ['router-link']
}
})
it("render item", () => {
expect(wrapper.text()).toContain("testproject")
expect(wrapper.text()).toContain("testsubject")
expect(wrapper.findComponent({name: "router-link"}).exists()).toBeTruthy()
});
})
19 changes: 6 additions & 13 deletions frontend/tests/components/home/listcontent/SubjectItem.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import {ref} from "vue";

const testSubjectInstructorsQuery = {
data: ref([{given_name: "test", surname: "instructor"}]),
isLoading: ref(true),
setLoading(value){
this.isLoading.value = value
}
isLoading: ref(false),
}

vi.mock("@/queries/Subject", () => ({
Expand All @@ -19,16 +16,12 @@ describe("SubjectItem", () => {
const wrapper = mount(SubjectItem, {
props: {
subject: ref({name: "testsubject"})
},
global: {
stubs: ['router-link']
}
})
it("render if loading", () => {
expect(wrapper.text()).toContain("testsubject")
expect(wrapper.findComponent({name: "VSkeletonLoader"}))
});
it("render subject item", async () => {
testSubjectInstructorsQuery.setLoading(false)
await wrapper.vm.$nextTick()
expect(wrapper.text()).toContain("testsubject")
expect(wrapper.text()).toContain("test instructor")
it("render", () => {
expect(wrapper.findComponent({name: 'router-link'}).exists()).toBeTruthy()
});
})
3 changes: 0 additions & 3 deletions frontend/tests/components/navigation/NavBar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ describe("NavBar", () => {
expect(wrapper.find('[data-test="navigation.home"]').exists()).toBeTruthy();
expect(wrapper.find('[data-test="navigation.subjects"]').exists()).toBeTruthy();
expect(wrapper.find('[data-test="navigation.projects"]').exists()).toBeTruthy();
expect(wrapper.find('[data-test="navigation.settings"]').exists()).toBeTruthy();

expect(wrapper.find('[data-test="navigation.admin"]').exists()).toBeFalsy();
expect(wrapper.find('[data-test="navigation.login"]').exists()).toBeFalsy();
Expand All @@ -65,7 +64,6 @@ describe("NavBar", () => {
expect(wrapper.find('[data-test="navigation.home"]').exists()).toBeTruthy();
expect(wrapper.find('[data-test="navigation.subjects"]').exists()).toBeTruthy();
expect(wrapper.find('[data-test="navigation.projects"]').exists()).toBeTruthy();
expect(wrapper.find('[data-test="navigation.settings"]').exists()).toBeTruthy();
expect(wrapper.find('[data-test="navigation.admin"]').exists()).toBeTruthy();

expect(wrapper.find('[data-test="navigation.login"]').exists()).toBeFalsy();
Expand All @@ -85,7 +83,6 @@ describe("NavBar", () => {
expect(wrapper.find('[data-test="navigation.home"]').exists()).toBeFalsy();
expect(wrapper.find('[data-test="navigation.courses"]').exists()).toBeFalsy();
expect(wrapper.find('[data-test="navigation.projects"]').exists()).toBeFalsy();
expect(wrapper.find('[data-test="navigation.settings"]').exists()).toBeFalsy();
expect(wrapper.find('[data-test="navigation.admin"]').exists()).toBeFalsy();
});
});
27 changes: 26 additions & 1 deletion frontend/tests/components/user/SearchTable.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
import { mount } from "@vue/test-utils";
import {expect, describe, it, vi} from "vitest";
import SearchTable from "@/components/user/SearchTable.vue"
import {ref} from "vue";

const mockRouter = {
push: vi.fn(),
};

vi.mock("vue-router", () => ({
useRouter: () => mockRouter,
}));

const testAuthStore = {
isLoggedIn: ref(true),
setLoggedIn(value) {
this.isLoggedIn.value = value;
},
};

vi.mock("@/stores/auth-store", () => ({
useAuthStore: vi.fn(() => testAuthStore),
}));

describe("SearchTable", async () => {
const ResizeObserverMock = vi.fn(() => ({
Expand All @@ -9,7 +29,12 @@ describe("SearchTable", async () => {
disconnect: vi.fn(),
}));
vi.stubGlobal("ResizeObserver", ResizeObserverMock);
const wrapper = mount(SearchTable, {});
const wrapper = mount(SearchTable, {
props: {
search: "test",
users: []
}
});
it("sorts booleans true first", () => {
const instance = wrapper.vm;
const sortBoolFunction = (instance as any).sortBool;
Expand Down
11 changes: 11 additions & 0 deletions frontend/tests/views/GroupsView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import {expect, describe, it, vi} from "vitest";
import GroupsView from "@/views/GroupsView.vue"
import {ref} from "vue";

const mockRouter = {
push: vi.fn(),
};

vi.mock("vue-router", () => ({
useRouter: () => mockRouter,
}));

const mockProject = {
name: "testproject"
}
Expand Down Expand Up @@ -95,6 +103,9 @@ describe("GroupsView", () => {
const wrapper = mount(GroupsView, {
props: {
projectId: 1
},
global: {
stubs: ['router-link']
}
});

Expand Down
Loading