@@ -53,9 +53,9 @@ let objectiveService = {
53
53
const quarterService = {
54
54
getAllQuarters ( ) : Observable < Quarter [ ] > {
55
55
return of ( [
56
+ { id : 199 , startDate : null , endDate : null , label : 'Backlog' } ,
56
57
{ id : 1 , startDate : quarter . startDate , endDate : quarter . endDate , label : quarter . label } ,
57
58
{ id : 2 , startDate : quarter . startDate , endDate : quarter . endDate , label : quarter . label } ,
58
- { id : 199 , startDate : null , endDate : null , label : 'Backlog' } ,
59
59
] ) ;
60
60
} ,
61
61
} ;
@@ -145,7 +145,7 @@ describe('ObjectiveDialogComponent', () => {
145
145
team = teams [ 0 ] . id ;
146
146
} ) ;
147
147
quarterService . getAllQuarters ( ) . subscribe ( ( quarters ) => {
148
- quarter = quarters [ 1 ] . id ;
148
+ quarter = quarters [ 2 ] . id ;
149
149
} ) ;
150
150
151
151
// Get input elements and set values
@@ -381,8 +381,8 @@ describe('ObjectiveDialogComponent', () => {
381
381
382
382
it ( 'should return correct value if allowed to save to backlog' , async ( ) => {
383
383
component . quarters = quarterList ;
384
- const isBacklogQuarterSpy = jest . spyOn ( component , 'isBacklogQuarter ' ) ;
385
- isBacklogQuarterSpy . mockReturnValue ( false ) ;
384
+ const isBacklogQuarterSpy = jest . spyOn ( component , 'isNotBacklogQuarter ' ) ;
385
+ isBacklogQuarterSpy . mockReturnValue ( true ) ;
386
386
387
387
component . data . action = 'duplicate' ;
388
388
fixture . detectChanges ( ) ;
@@ -396,6 +396,7 @@ describe('ObjectiveDialogComponent', () => {
396
396
expect ( component . allowedToSaveBacklog ( ) ) . toBeTruthy ( ) ;
397
397
398
398
component . state = 'ONGOING' ;
399
+ isBacklogQuarterSpy . mockReturnValue ( false ) ;
399
400
fixture . detectChanges ( ) ;
400
401
expect ( component . allowedToSaveBacklog ( ) ) . toBeFalsy ( ) ;
401
402
@@ -512,7 +513,7 @@ describe('ObjectiveDialogComponent', () => {
512
513
expect ( component . objectiveForm . getRawValue ( ) . alignment ) . toEqual ( null ) ;
513
514
} ) ;
514
515
515
- it ( 'should load not include current team in alignment possibilities' , async ( ) => {
516
+ it ( 'should not include current team in alignment possibilities' , async ( ) => {
516
517
objectiveService . getAlignmentPossibilities . mockReturnValue ( of ( [ alignmentPossibility1 , alignmentPossibility2 ] ) ) ;
517
518
component . generateAlignmentPossibilities ( 3 , null , 1 ) ;
518
519
let alignmentPossibilities = null ;
@@ -521,7 +522,7 @@ describe('ObjectiveDialogComponent', () => {
521
522
} ) ;
522
523
523
524
expect ( alignmentPossibilities ) . toStrictEqual ( [ alignmentPossibility2 ] ) ;
524
- expect ( component . filteredOptions$ . getValue ( ) ) . toEqual ( [ alignmentPossibility1 , alignmentPossibility2 ] ) ;
525
+ expect ( component . filteredOptions$ . getValue ( ) ) . toEqual ( [ alignmentPossibility2 ] ) ;
525
526
expect ( component . objectiveForm . getRawValue ( ) . alignment ) . toEqual ( null ) ;
526
527
} ) ;
527
528
@@ -679,6 +680,13 @@ describe('ObjectiveDialogComponent', () => {
679
680
jest . spyOn ( objectiveService , 'getAlignmentPossibilities' ) . mockReturnValue ( of ( [ ] ) ) ;
680
681
fixture = TestBed . createComponent ( ObjectiveFormComponent ) ;
681
682
component = fixture . componentInstance ;
683
+ component . data = {
684
+ objective : {
685
+ objectiveId : 1 ,
686
+ teamId : 1 ,
687
+ } ,
688
+ action : 'releaseBacklog' ,
689
+ } ;
682
690
fixture . detectChanges ( ) ;
683
691
loader = TestbedHarnessEnvironment . loader ( fixture ) ;
684
692
} ) ;
@@ -688,15 +696,7 @@ describe('ObjectiveDialogComponent', () => {
688
696
} ) ;
689
697
690
698
it ( 'should set correct default value if objective is released in backlog' , async ( ) => {
691
- component . data = {
692
- objective : {
693
- objectiveId : 1 ,
694
- teamId : 1 ,
695
- } ,
696
- action : 'releaseBacklog' ,
697
- } ;
698
-
699
- const isBacklogQuarterSpy = jest . spyOn ( component , 'isBacklogQuarter' ) ;
699
+ const isBacklogQuarterSpy = jest . spyOn ( component , 'isNotBacklogQuarter' ) ;
700
700
isBacklogQuarterSpy . mockReturnValue ( false ) ;
701
701
702
702
const routerHarness = await RouterTestingHarness . create ( ) ;
0 commit comments