Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
undernagruzez committed Sep 30, 2024
1 parent d8d0c9b commit 7bd2101
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, inject, input, OnInit, output } from '@angular/core';
import { Component, OnInit, inject, input, output } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
import { MockProvider } from 'ng-mocks';
import { ProfileService } from 'app/shared/layouts/profiles/profile.service';
import { of, Observable } from 'rxjs';
import { Observable, of } from 'rxjs';
import { Exercise, ExerciseType } from 'app/entities/exercise.model';
import { StudentParticipation } from 'app/entities/participation/student-participation.model';
import { By } from '@angular/platform-browser';
Expand All @@ -10,10 +10,10 @@ import { AlertService } from 'app/core/util/alert.service';
import { CourseExerciseService } from 'app/exercises/shared/course-exercises/course-exercise.service';
import { HttpClient, HttpResponse } from '@angular/common/http';
import { ExerciseService } from 'app/exercises/shared/exercise/exercise.service';
import { ParticipationService } from 'app/exercises/shared/participation/participation.service';
import { RequestFeedbackButtonComponent } from 'app/overview/exercise-details/request-feedback-button/request-feedback-button.component';
import { ArtemisTestModule } from '../../../../test.module';
import { MockProfileService } from '../../../../helpers/mocks/service/mock-profile.service';
import { ProfileInfo } from 'app/shared/layouts/profiles/profile-info.model';

describe('RequestFeedbackButtonComponent', () => {
let component: RequestFeedbackButtonComponent;
Expand All @@ -23,7 +23,6 @@ describe('RequestFeedbackButtonComponent', () => {
let alertService: AlertService;
let courseExerciseService: CourseExerciseService;
let exerciseService: ExerciseService;
let participationService: ParticipationService;

beforeEach(() => {
return TestBed.configureTestingModule({
Expand All @@ -37,14 +36,13 @@ describe('RequestFeedbackButtonComponent', () => {
debugElement = fixture.debugElement;
courseExerciseService = debugElement.injector.get(CourseExerciseService);
exerciseService = debugElement.injector.get(ExerciseService);
participationService = debugElement.injector.get(ParticipationService);
profileService = debugElement.injector.get(ProfileService);
alertService = debugElement.injector.get(AlertService);
});
});

function setAthenaEnabled(enabled: boolean) {
jest.spyOn(profileService, 'getProfileInfo').mockReturnValue(of({ activeProfiles: enabled ? ['athena'] : [] }));
jest.spyOn(profileService, 'getProfileInfo').mockReturnValue(of({ activeProfiles: enabled ? ['athena'] : [] } as ProfileInfo));
}

function mockExerciseDetails(exercise: Exercise) {
Expand Down

0 comments on commit 7bd2101

Please sign in to comment.