@@ -17,8 +17,9 @@ import { ensureString } from '@salesforce/ts-types';
17
17
import { ComponentStatus } from '@salesforce/source-deploy-retrieve' ;
18
18
19
19
import { DeployCommandResult } from '@salesforce/plugin-source/lib/formatters/deployResultFormatter' ;
20
- import { StatusResult } from '../../../src/commands/force/source/status' ;
20
+ import { StatusResult } from '../../../src/commands/force/source/beta/ status' ;
21
21
import { PullResponse } from '../../../src/shared/types' ;
22
+ import { replaceRenamedCommands } from '../../../src/compatibility' ;
22
23
23
24
let session : TestSession ;
24
25
let hubUsername : string ;
@@ -42,13 +43,17 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => {
42
43
43
44
describe ( 'basic status and pull' , ( ) => {
44
45
it ( 'detects the initial metadata status' , ( ) => {
45
- const result = execCmd < StatusResult [ ] > ( 'force:source:status --json' , { ensureExitCode : 0 } ) . jsonOutput . result ;
46
+ const result = execCmd < StatusResult [ ] > ( replaceRenamedCommands ( 'force:source:status --json' ) , {
47
+ ensureExitCode : 0 ,
48
+ } ) . jsonOutput . result ;
46
49
expect ( result ) . to . be . an . instanceof ( Array ) ;
47
50
// the fields should be populated
48
51
expect ( result . every ( ( row ) => row . type && row . fullName ) ) . to . equal ( true ) ;
49
52
} ) ;
50
53
it ( 'pushes the initial metadata to the org' , ( ) => {
51
- const result = execCmd < DeployCommandResult > ( 'force:source:push --json' , { ensureExitCode : 0 } ) . jsonOutput . result ;
54
+ const result = execCmd < DeployCommandResult > ( replaceRenamedCommands ( 'force:source:push --json' ) , {
55
+ ensureExitCode : 0 ,
56
+ } ) . jsonOutput . result ;
52
57
expect ( result . deployedSource ) . to . be . an . instanceof ( Array ) ;
53
58
expect ( result . deployedSource , JSON . stringify ( result ) ) . to . have . lengthOf ( 234 ) ;
54
59
expect (
@@ -57,23 +62,29 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => {
57
62
) . to . equal ( true ) ;
58
63
} ) ;
59
64
it ( 'sees no local changes (all were committed from push), but profile updated in remote' , ( ) => {
60
- const localResult = execCmd < StatusResult [ ] > ( 'force:source:status --json --local' , { ensureExitCode : 0 } )
61
- . jsonOutput . result ;
65
+ const localResult = execCmd < StatusResult [ ] > ( replaceRenamedCommands ( 'force:source:status --json --local' ) , {
66
+ ensureExitCode : 0 ,
67
+ } ) . jsonOutput . result ;
62
68
expect ( localResult ) . to . deep . equal ( [ ] ) ;
63
69
64
- const remoteResult = execCmd < StatusResult [ ] > ( 'force:source:status --json --remote' , { ensureExitCode : 0 } )
65
- . jsonOutput . result ;
70
+ const remoteResult = execCmd < StatusResult [ ] > ( replaceRenamedCommands ( 'force:source:status --json --remote' ) , {
71
+ ensureExitCode : 0 ,
72
+ } ) . jsonOutput . result ;
66
73
expect ( remoteResult . length ) . to . equal ( 1 ) ;
67
74
expect ( remoteResult . some ( ( item ) => item . type === 'Profile' ) ) . to . equal ( true ) ;
68
75
} ) ;
69
76
70
77
it ( 'can pull the remote profile' , ( ) => {
71
- const pullResult = execCmd < PullResponse [ ] > ( 'force:source:pull --json' , { ensureExitCode : 0 } ) . jsonOutput . result ;
78
+ const pullResult = execCmd < PullResponse [ ] > ( replaceRenamedCommands ( 'force:source:pull --json' ) , {
79
+ ensureExitCode : 0 ,
80
+ } ) . jsonOutput . result ;
72
81
expect ( pullResult . some ( ( item ) => item . type === 'Profile' ) ) . to . equal ( true ) ;
73
82
} ) ;
74
83
75
84
it ( 'sees no local or remote changes' , ( ) => {
76
- const result = execCmd < StatusResult [ ] > ( 'force:source:status --json' , { ensureExitCode : 0 } ) . jsonOutput . result ;
85
+ const result = execCmd < StatusResult [ ] > ( replaceRenamedCommands ( 'force:source:status --json' ) , {
86
+ ensureExitCode : 0 ,
87
+ } ) . jsonOutput . result ;
77
88
expect ( result ) . to . have . length ( 0 ) ;
78
89
} ) ;
79
90
@@ -83,8 +94,9 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => {
83
94
fs . promises . unlink ( path . join ( classDir , 'TestOrderController.cls' ) ) ,
84
95
fs . promises . unlink ( path . join ( classDir , 'TestOrderController.cls-meta.xml' ) ) ,
85
96
] ) ;
86
- const result = execCmd < StatusResult [ ] > ( 'force:source:status --json --local' , { ensureExitCode : 0 } ) . jsonOutput
87
- . result ;
97
+ const result = execCmd < StatusResult [ ] > ( replaceRenamedCommands ( 'force:source:status --json --local' ) , {
98
+ ensureExitCode : 0 ,
99
+ } ) . jsonOutput . result ;
88
100
expect ( result ) . to . deep . equal ( [
89
101
{
90
102
type : 'ApexClass' ,
@@ -101,26 +113,30 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => {
101
113
] ) ;
102
114
} ) ;
103
115
it ( 'does not see any change in remote status' , ( ) => {
104
- const result = execCmd < StatusResult [ ] > ( 'force:source:status --json --remote' , { ensureExitCode : 0 } ) . jsonOutput
105
- . result ;
116
+ const result = execCmd < StatusResult [ ] > ( replaceRenamedCommands ( 'force:source:status --json --remote' ) , {
117
+ ensureExitCode : 0 ,
118
+ } ) . jsonOutput . result ;
106
119
expect ( result ) . to . have . length ( 0 ) ;
107
120
} ) ;
108
121
109
122
it ( 'pushes the local delete to the org' , ( ) => {
110
- const result = execCmd < DeployCommandResult > ( 'force:source:push --json' , { ensureExitCode : 0 } ) . jsonOutput . result ;
123
+ const result = execCmd < DeployCommandResult > ( replaceRenamedCommands ( 'force:source:push --json' ) , {
124
+ ensureExitCode : 0 ,
125
+ } ) . jsonOutput . result ;
111
126
expect ( result . deployedSource ) . to . be . an . instanceof ( Array ) . with . length ( 2 ) ;
112
127
} ) ;
113
128
it ( 'sees no local changes' , ( ) => {
114
- const result = execCmd < StatusResult [ ] > ( 'force:source:status --json --local' , { ensureExitCode : 0 } ) . jsonOutput
115
- . result ;
129
+ const result = execCmd < StatusResult [ ] > ( replaceRenamedCommands ( 'force:source:status --json --local' ) , {
130
+ ensureExitCode : 0 ,
131
+ } ) . jsonOutput . result ;
116
132
expect ( result ) . to . be . an . instanceof ( Array ) . with . length ( 0 ) ;
117
133
} ) ;
118
134
} ) ;
119
135
120
136
describe ( 'non-successes' , ( ) => {
121
137
it ( 'should throw an err when attempting to pull from a non scratch-org' , ( ) => {
122
138
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
123
- const failure = execCmd ( `force:source:status -u ${ hubUsername } --remote --json` , {
139
+ const failure = execCmd ( replaceRenamedCommands ( `force:source:status -u ${ hubUsername } --remote --json` ) , {
124
140
ensureExitCode : 1 ,
125
141
} ) . jsonOutput ;
126
142
expect ( failure . name ) . to . equal ( 'NonSourceTrackedOrgError' ) ;
0 commit comments