Skip to content

Commit

Permalink
Try to fix frontend unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelMoeri authored and kcinay055679 committed Nov 4, 2024
1 parent de6d3f0 commit edf9272
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { ObjectiveMin } from '../../shared/types/model/ObjectiveMin';
import { MenuEntry } from '../../shared/types/menu-entry';
import { of } from 'rxjs';
import { ObjectiveService } from '../../services/objective.service';
import { ObjectiveMenuActions } from './ObjectiveMenuActions';
import { ObjectiveMenuActionsService } from '../../services/objective-menu-actions.service';

const overviewServiceMock = {
getObjectiveWithKeyresults: jest.fn(),
Expand All @@ -39,6 +41,8 @@ const objectiveServiceMock = {
};
describe('ObjectiveColumnComponent', () => {
let component: ObjectiveComponent;
let bum: ObjectiveMenuActions;
let bam: ObjectiveMenuActionsService;
let fixture: ComponentFixture<ObjectiveComponent>;
let loader: HarnessLoader;
beforeEach(() => {
Expand Down Expand Up @@ -116,19 +120,19 @@ describe('ObjectiveColumnComponent', () => {
});

it('Correct method should be called when back to draft is clicked', () => {
jest.spyOn(component, 'objectiveBackToDraft');
jest.spyOn(bum, 'objectiveBackToDraft');
component.objective$.next(objectiveMin);
fixture.detectChanges();
const menuEntry: MenuEntry =
component.getOngoingMenuActions()[
component
bam.getOngoingMenuActions()[
bam
.getOngoingMenuActions()
.map((menuAction) => menuAction.action)
.indexOf('todraft')
];
component.handleDialogResult(menuEntry, { endState: '', comment: null, objective: objective });
fixture.detectChanges();
expect(component.objectiveBackToDraft).toHaveBeenCalled();
expect(bum.objectiveBackToDraft).toHaveBeenCalled();
});

test('Should set isBacklogQuarter right', async () => {
Expand Down

0 comments on commit edf9272

Please sign in to comment.