Skip to content

Commit

Permalink
fix exercise groups tests
Browse files Browse the repository at this point in the history
  • Loading branch information
coolchock committed Dec 10, 2024
1 parent 9fb875e commit 31b3233
Showing 1 changed file with 6 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HttpResponse } from '@angular/common/http';
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
import { ActivatedRoute, Router, convertToParamMap, provideRouter } from '@angular/router';
import { ActivatedRoute, Router, convertToParamMap } from '@angular/router';
import { faCheckDouble, faFileUpload, faFont, faKeyboard, faProjectDiagram } from '@fortawesome/free-solid-svg-icons';
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { AlertService } from 'app/core/util/alert.service';
Expand All @@ -13,22 +13,12 @@ import { Exercise, ExerciseType } from 'app/entities/exercise.model';
import { ExamManagementService } from 'app/exam/manage/exam-management.service';
import { ExerciseGroupService } from 'app/exam/manage/exercise-groups/exercise-group.service';
import { ExerciseGroupsComponent } from 'app/exam/manage/exercise-groups/exercise-groups.component';
import { FileUploadExerciseGroupCellComponent } from 'app/exam/manage/exercise-groups/file-upload-exercise-cell/file-upload-exercise-group-cell.component';
import { ModelingExerciseGroupCellComponent } from 'app/exam/manage/exercise-groups/modeling-exercise-cell/modeling-exercise-group-cell.component';
import { ProgrammingExerciseGroupCellComponent } from 'app/exam/manage/exercise-groups/programming-exercise-cell/programming-exercise-group-cell.component';
import { QuizExerciseGroupCellComponent } from 'app/exam/manage/exercise-groups/quiz-exercise-cell/quiz-exercise-group-cell.component';
import { ProgrammingExerciseInstructorStatusComponent } from 'app/exercises/programming/manage/status/programming-exercise-instructor-status.component';
import { ExamExerciseRowButtonsComponent } from 'app/exercises/shared/exam-exercise-row-buttons/exam-exercise-row-buttons.component';
import { HasAnyAuthorityDirective } from 'app/shared/auth/has-any-authority.directive';
import { DeleteButtonDirective } from 'app/shared/delete-dialog/delete-button.directive';
import { TranslateDirective } from 'app/shared/language/translate.directive';
import { ArtemisTranslatePipe } from 'app/shared/pipes/artemis-translate.pipe';
import dayjs from 'dayjs/esm';
import { MockComponent, MockDirective, MockPipe, MockProvider } from 'ng-mocks';
import { MockProvider } from 'ng-mocks';
import { of } from 'rxjs';
import { MockRouter } from '../../../../helpers/mocks/mock-router';
import { MockNgbModalService } from '../../../../helpers/mocks/service/mock-ngb-modal.service';
import { ArtemisTestModule } from '../../../../test.module';
import { MockNgbModalService } from '../../../../helpers/mocks/service/mock-ngb-modal.service';

describe('Exercise Groups Component', () => {
const course = new Course();
Expand Down Expand Up @@ -58,28 +48,10 @@ describe('Exercise Groups Component', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [ArtemisTestModule],
declarations: [
ExerciseGroupsComponent,
MockComponent(ExamExerciseRowButtonsComponent),
MockComponent(ProgrammingExerciseInstructorStatusComponent),
MockDirective(DeleteButtonDirective),
MockDirective(HasAnyAuthorityDirective),
MockPipe(ArtemisTranslatePipe),
MockComponent(FileUploadExerciseGroupCellComponent),
MockComponent(ModelingExerciseGroupCellComponent),
MockComponent(ProgrammingExerciseGroupCellComponent),
MockComponent(QuizExerciseGroupCellComponent),
MockDirective(TranslateDirective),
],
providers: [
provideRouter([]),
MockProvider(AlertService),
{ provide: ActivatedRoute, useValue: route },
{ provide: Router, useClass: MockRouter },
{ provide: NgbModal, useClass: MockNgbModalService },
],
imports: [ArtemisTestModule, ExerciseGroupsComponent],
providers: [{ provide: ActivatedRoute, useValue: route }, { provide: Router, useClass: MockRouter }, MockProvider(AlertService)],
})
.overrideProvider(NgbModal, { useValue: new MockNgbModalService() })
.compileComponents()
.then(() => {
fixture = TestBed.createComponent(ExerciseGroupsComponent);
Expand Down

0 comments on commit 31b3233

Please sign in to comment.