File tree Expand file tree Collapse file tree 4 files changed +17
-15
lines changed Expand file tree Collapse file tree 4 files changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,8 @@ describe('Selection', () => {
51
51
. scrollIntoView ( )
52
52
. should ( 'be.visible' )
53
53
. within ( ( ) => {
54
- const changedFileNames = mockBackend . getBranchChangesFileNames ( stackId , stackName ) ;
54
+ const branch = `refs/heads/${ stackName } ` ;
55
+ const changedFileNames = mockBackend . getBranchChangesFileNames ( stackId , branch ) ;
55
56
for ( const fileName of changedFileNames ) {
56
57
cy . getByTestId ( 'file-list-item' , fileName ) . should ( 'be.visible' ) ;
57
58
}
Original file line number Diff line number Diff line change @@ -442,10 +442,10 @@ export default class MockBackend {
442
442
443
443
public getBranchChanges ( args : InvokeArgs | undefined ) : TreeChanges {
444
444
if ( ! args || ! isGetBranchChangesParams ( args ) ) {
445
- throw new Error ( 'Invalid arguments for getBranchChanges' ) ;
445
+ throw new Error ( 'Invalid arguments for getBranchChanges: ' + JSON . stringify ( args ) ) ;
446
446
}
447
447
448
- const { stackId, branchName } = args ;
448
+ const { stackId, branch } = args ;
449
449
450
450
if ( ! stackId ) {
451
451
return {
@@ -463,9 +463,9 @@ export default class MockBackend {
463
463
throw new Error ( `No changes found for stack with ID ${ stackId } ` ) ;
464
464
}
465
465
466
- const branchChanges = stackBranchChanges . get ( branchName ) ;
466
+ const branchChanges = stackBranchChanges . get ( branch ) ;
467
467
if ( ! branchChanges ) {
468
- throw new Error ( `No changes found for branch with name ${ branchName } ` ) ;
468
+ throw new Error ( `No changes found for branch with name ${ branch } ` ) ;
469
469
}
470
470
471
471
return {
@@ -480,10 +480,10 @@ export default class MockBackend {
480
480
481
481
public getBranchChangesFileNames (
482
482
stackId : string ,
483
- branchName : string ,
483
+ branch : string ,
484
484
projectId : string = PROJECT_ID
485
485
) : string [ ] {
486
- const changes = this . getBranchChanges ( { projectId, stackId, branchName } ) ;
486
+ const changes = this . getBranchChanges ( { projectId, stackId, branch } ) ;
487
487
return changes . changes . map ( ( change ) => change . path ) . map ( ( path ) => path . split ( '/' ) . pop ( ) ! ) ;
488
488
}
489
489
Original file line number Diff line number Diff line change @@ -148,8 +148,7 @@ export function isGetCommitChangesParams(args: unknown): args is GetCommitChange
148
148
export type GetBranchChangesParams = {
149
149
projectId : string ;
150
150
stackId ?: string ;
151
- branchName : string ;
152
- remote ?: string ;
151
+ branch : string ;
153
152
} ;
154
153
155
154
export function isGetBranchChangesParams ( args : unknown ) : args is GetBranchChangesParams {
@@ -159,9 +158,8 @@ export function isGetBranchChangesParams(args: unknown): args is GetBranchChange
159
158
'projectId' in args &&
160
159
typeof args [ 'projectId' ] === 'string' &&
161
160
( typeof ( args as any ) . stackId === 'string' || ( args as any ) . stackId === undefined ) &&
162
- 'branchName' in args &&
163
- typeof args [ 'branchName' ] === 'string' &&
164
- ( typeof ( args as any ) . remote === 'string' || ( args as any ) . remote === undefined )
161
+ 'branch' in args &&
162
+ typeof args [ 'branch' ] === 'string'
165
163
) ;
166
164
}
167
165
Original file line number Diff line number Diff line change @@ -635,13 +635,16 @@ export default class BranchesWithChanges extends MockBackend {
635
635
this . stackDetails . set ( MOCK_STACK_C_ID , MOCK_STACK_DETAILS_C ) ;
636
636
637
637
const stackAChanges = new Map < string , TreeChange [ ] > ( ) ;
638
- stackAChanges . set ( MOCK_STACK_A_ID , MOCK_BRANCH_A_CHANGES ) ;
638
+ const branchARef = `refs/heads/${ MOCK_STACK_A_ID } ` ;
639
+ stackAChanges . set ( branchARef , MOCK_BRANCH_A_CHANGES ) ;
639
640
640
641
const stackBChanges = new Map < string , TreeChange [ ] > ( ) ;
641
- stackBChanges . set ( MOCK_STACK_B_ID , MOCK_BRANCH_B_CHANGES ) ;
642
+ const branchBRef = `refs/heads/${ MOCK_STACK_B_ID } ` ;
643
+ stackBChanges . set ( branchBRef , MOCK_BRANCH_B_CHANGES ) ;
642
644
643
645
const stackCChanges = new Map < string , TreeChange [ ] > ( ) ;
644
- stackCChanges . set ( MOCK_STACK_C_ID , MOCK_BRANCH_C_CHANGES ) ;
646
+ const branchCRef = `refs/heads/${ MOCK_STACK_C_ID } ` ;
647
+ stackCChanges . set ( branchCRef , MOCK_BRANCH_C_CHANGES ) ;
645
648
646
649
this . branchChanges . set ( MOCK_STACK_A_ID , stackAChanges ) ;
647
650
this . branchChanges . set ( MOCK_STACK_B_ID , stackBChanges ) ;
You can’t perform that action at this time.
0 commit comments