@@ -67,6 +67,7 @@ version: 1.0.0
6767 required List <String > expectedOutput,
6868 String ? expectedVersion,
6969 List <String > expectedChangelogSnippets = const < String > [],
70+ List <ProcessCall > expectedGitCommands = const < ProcessCall > [],
7071 }) async {
7172 for (final MapEntry <String , String > entry in changelogs.entries) {
7273 createChangelogFile (entry.key, entry.value);
@@ -89,6 +90,7 @@ version: 1.0.0
8990 expect (changelogContent, contains (snippet));
9091 }
9192 }
93+ expect (gitProcessRunner.recordedCalls, orderedEquals (expectedGitCommands));
9294 }
9395
9496 group ('happy path' , () {
@@ -109,6 +111,23 @@ version: minor
109111 ' Updating pubspec.yaml to version 1.1.0...' ,
110112 ' Updating CHANGELOG.md...' ,
111113 ],
114+ expectedGitCommands: < ProcessCall > [
115+ const ProcessCall (
116+ 'git-checkout' , < String > ['-b' , 'release-branch' ], null ),
117+ const ProcessCall ('git-rm' ,
118+ < String > ['/packages/a_package/pending_changelogs/a.yaml' ], null ),
119+ const ProcessCall (
120+ 'git-add' ,
121+ < String > [
122+ '/packages/a_package/pubspec.yaml' ,
123+ '/packages/a_package/CHANGELOG.md'
124+ ],
125+ null ),
126+ const ProcessCall ('git-commit' ,
127+ < String > ['-m' , 'a_package: Prepare for release' ], null ),
128+ const ProcessCall (
129+ 'git-push' , < String > ['origin' , 'release-branch' ], null ),
130+ ],
112131 );
113132 });
114133
@@ -129,6 +148,23 @@ version: major
129148 ' Updating pubspec.yaml to version 2.0.0...' ,
130149 ' Updating CHANGELOG.md...' ,
131150 ],
151+ expectedGitCommands: < ProcessCall > [
152+ const ProcessCall (
153+ 'git-checkout' , < String > ['-b' , 'release-branch' ], null ),
154+ const ProcessCall ('git-rm' ,
155+ < String > ['/packages/a_package/pending_changelogs/a.yaml' ], null ),
156+ const ProcessCall (
157+ 'git-add' ,
158+ < String > [
159+ '/packages/a_package/pubspec.yaml' ,
160+ '/packages/a_package/CHANGELOG.md'
161+ ],
162+ null ),
163+ const ProcessCall ('git-commit' ,
164+ < String > ['-m' , 'a_package: Prepare for release' ], null ),
165+ const ProcessCall (
166+ 'git-push' , < String > ['origin' , 'release-branch' ], null ),
167+ ],
132168 );
133169 });
134170
@@ -149,6 +185,23 @@ version: patch
149185 ' Updating pubspec.yaml to version 1.0.1...' ,
150186 ' Updating CHANGELOG.md...' ,
151187 ],
188+ expectedGitCommands: < ProcessCall > [
189+ const ProcessCall (
190+ 'git-checkout' , < String > ['-b' , 'release-branch' ], null ),
191+ const ProcessCall ('git-rm' ,
192+ < String > ['/packages/a_package/pending_changelogs/a.yaml' ], null ),
193+ const ProcessCall (
194+ 'git-add' ,
195+ < String > [
196+ '/packages/a_package/pubspec.yaml' ,
197+ '/packages/a_package/CHANGELOG.md'
198+ ],
199+ null ),
200+ const ProcessCall ('git-commit' ,
201+ < String > ['-m' , 'a_package: Prepare for release' ], null ),
202+ const ProcessCall (
203+ 'git-push' , < String > ['origin' , 'release-branch' ], null ),
204+ ],
152205 );
153206 });
154207
@@ -176,6 +229,25 @@ version: major
176229 ' Updating pubspec.yaml to version 2.0.0...' ,
177230 ' Updating CHANGELOG.md...' ,
178231 ],
232+ expectedGitCommands: < ProcessCall > [
233+ const ProcessCall (
234+ 'git-checkout' , < String > ['-b' , 'release-branch' ], null ),
235+ const ProcessCall ('git-rm' ,
236+ < String > ['/packages/a_package/pending_changelogs/a.yaml' ], null ),
237+ const ProcessCall ('git-rm' ,
238+ < String > ['/packages/a_package/pending_changelogs/b.yaml' ], null ),
239+ const ProcessCall (
240+ 'git-add' ,
241+ < String > [
242+ '/packages/a_package/pubspec.yaml' ,
243+ '/packages/a_package/CHANGELOG.md'
244+ ],
245+ null ),
246+ const ProcessCall ('git-commit' ,
247+ < String > ['-m' , 'a_package: Prepare for release' ], null ),
248+ const ProcessCall (
249+ 'git-push' , < String > ['origin' , 'release-branch' ], null ),
250+ ],
179251 );
180252 });
181253
0 commit comments