Skip to content

Commit 4b662a7

Browse files
committed
fix: Supported git default branch naming on tests.
1 parent 45086c4 commit 4b662a7

File tree

7 files changed

+66
-38
lines changed

7 files changed

+66
-38
lines changed

RelaxVersioner.Core.Tests/AnalyzerEdgeCasesTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public async Task LookupVersionLabel_EmptyRepository_ReturnsDefaultVersion()
2929
Directory.CreateDirectory(tempPath);
3030

3131
// Initialize empty git repository
32-
await TestUtilities.RunGitCommand(tempPath, "init");
32+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
3333
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
3434
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
3535

@@ -57,7 +57,7 @@ public async Task LookupVersionLabel_DetachedHead_ReturnsCorrectVersion()
5757
Directory.CreateDirectory(tempPath);
5858

5959
// Initialize repository with commits and tag
60-
await TestUtilities.RunGitCommand(tempPath, "init");
60+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
6161
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
6262
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
6363

@@ -98,7 +98,7 @@ public async Task LookupVersionLabel_WithInvalidTags_IgnoresInvalidOnes()
9898
{
9999
Directory.CreateDirectory(tempPath);
100100

101-
await TestUtilities.RunGitCommand(tempPath, "init");
101+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
102102
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
103103
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
104104

@@ -139,7 +139,7 @@ public async Task LookupVersionLabel_WithOrphanBranch_ReturnsDefaultVersion()
139139
{
140140
Directory.CreateDirectory(tempPath);
141141

142-
await TestUtilities.RunGitCommand(tempPath, "init");
142+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
143143
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
144144
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
145145

@@ -183,7 +183,7 @@ public async Task LookupVersionLabel_DeepHistory_PerformsCorrectly()
183183
{
184184
Directory.CreateDirectory(tempPath);
185185

186-
await TestUtilities.RunGitCommand(tempPath, "init");
186+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
187187
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
188188
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
189189

@@ -225,7 +225,7 @@ public async Task LookupVersionLabel_MultipleTagsOnSameCommit_ChoosesLargest()
225225
{
226226
Directory.CreateDirectory(tempPath);
227227

228-
await TestUtilities.RunGitCommand(tempPath, "init");
228+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
229229
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
230230
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
231231

@@ -264,7 +264,7 @@ public async Task LookupVersionLabel_WithWorkingDirectoryChanges_IncrementsCorre
264264
{
265265
Directory.CreateDirectory(tempPath);
266266

267-
await TestUtilities.RunGitCommand(tempPath, "init");
267+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
268268
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
269269
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
270270

@@ -307,7 +307,7 @@ public async Task LookupVersionLabel_DifferentVersionFormats_ParsesCorrectly()
307307
{
308308
Directory.CreateDirectory(tempPath);
309309

310-
await TestUtilities.RunGitCommand(tempPath, "init");
310+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
311311
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
312312
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
313313

RelaxVersioner.Core.Tests/AnalyzerMergeScenarioTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public async Task LookupVersionLabel_SimpleMerge_ChoosesLargerVersion()
2828
{
2929
Directory.CreateDirectory(tempPath);
3030

31-
await TestUtilities.RunGitCommand(tempPath, "init");
31+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
3232
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
3333
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
3434

@@ -82,7 +82,7 @@ public async Task LookupVersionLabel_MultipleMerges_ChoosesLargestVersion()
8282
{
8383
Directory.CreateDirectory(tempPath);
8484

85-
await TestUtilities.RunGitCommand(tempPath, "init");
85+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
8686
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
8787
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
8888

@@ -149,7 +149,7 @@ public async Task LookupVersionLabel_DeepMergeHistory_PerformsCorrectly()
149149
{
150150
Directory.CreateDirectory(tempPath);
151151

152-
await TestUtilities.RunGitCommand(tempPath, "init");
152+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
153153
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
154154
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
155155

@@ -204,7 +204,7 @@ public async Task LookupVersionLabel_NoMergeCommitsWithTags_IncrementsFromBase()
204204
{
205205
Directory.CreateDirectory(tempPath);
206206

207-
await TestUtilities.RunGitCommand(tempPath, "init");
207+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
208208
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
209209
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
210210

@@ -254,7 +254,7 @@ public async Task LookupVersionLabel_OctopusMerge_ChoosesLargestVersion()
254254
{
255255
Directory.CreateDirectory(tempPath);
256256

257-
await TestUtilities.RunGitCommand(tempPath, "init");
257+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
258258
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
259259
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
260260

@@ -307,7 +307,7 @@ public async Task LookupVersionLabel_NestedMerges_HandlesRecursion()
307307
{
308308
Directory.CreateDirectory(tempPath);
309309

310-
await TestUtilities.RunGitCommand(tempPath, "init");
310+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
311311
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
312312
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
313313

RelaxVersioner.Core.Tests/AnalyzerPerformanceTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public async Task LookupVersionLabel_LargeHistoryPerformance_CompletesInReasonab
3131
{
3232
Directory.CreateDirectory(tempPath);
3333

34-
await TestUtilities.RunGitCommand(tempPath, "init");
34+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
3535
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
3636
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
3737

@@ -93,7 +93,7 @@ public async Task LookupVersionLabel_ManyTags_PerformsCorrectly()
9393
{
9494
Directory.CreateDirectory(tempPath);
9595

96-
await TestUtilities.RunGitCommand(tempPath, "init");
96+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
9797
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
9898
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
9999

@@ -142,7 +142,7 @@ public async Task LookupVersionLabel_ComplexMergeTree_PerformsCorrectly()
142142
{
143143
Directory.CreateDirectory(tempPath);
144144

145-
await TestUtilities.RunGitCommand(tempPath, "init");
145+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
146146
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
147147
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
148148

@@ -204,7 +204,7 @@ public async Task LookupVersionLabel_WithCancellation_RespondsToToken()
204204
{
205205
Directory.CreateDirectory(tempPath);
206206

207-
await TestUtilities.RunGitCommand(tempPath, "init");
207+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
208208
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
209209
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
210210

@@ -243,7 +243,7 @@ public async Task LookupVersionLabel_ConcurrentAccess_HandledCorrectly()
243243
{
244244
Directory.CreateDirectory(tempPath);
245245

246-
await TestUtilities.RunGitCommand(tempPath, "init");
246+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
247247
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
248248
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
249249

@@ -298,7 +298,7 @@ public async Task LookupVersionLabel_WithWorkingDirectoryCheck_PerformsCorrectly
298298
{
299299
Directory.CreateDirectory(tempPath);
300300

301-
await TestUtilities.RunGitCommand(tempPath, "init");
301+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
302302
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
303303
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
304304

RelaxVersioner.Core.Tests/AnalyzerTagProcessingTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public async Task LookupVersionLabel_TagWithDifferentSeparators_ParsesCorrectly(
2828
{
2929
Directory.CreateDirectory(tempPath);
3030

31-
await TestUtilities.RunGitCommand(tempPath, "init");
31+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
3232
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
3333
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
3434

@@ -67,7 +67,7 @@ public async Task LookupVersionLabel_TagWithVPrefix_ParsesCorrectly()
6767
{
6868
Directory.CreateDirectory(tempPath);
6969

70-
await TestUtilities.RunGitCommand(tempPath, "init");
70+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
7171
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
7272
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
7373

@@ -104,7 +104,7 @@ public async Task LookupVersionLabel_TagsWithInvalidVersions_IgnoresInvalid()
104104
{
105105
Directory.CreateDirectory(tempPath);
106106

107-
await TestUtilities.RunGitCommand(tempPath, "init");
107+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
108108
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
109109
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
110110

@@ -149,7 +149,7 @@ public async Task LookupVersionLabel_SingleComponentTag_IsIgnored()
149149
{
150150
Directory.CreateDirectory(tempPath);
151151

152-
await TestUtilities.RunGitCommand(tempPath, "init");
152+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
153153
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
154154
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
155155

@@ -190,7 +190,7 @@ public async Task LookupVersionLabel_TagsOnDifferentCommits_ChoosesCorrectly()
190190
{
191191
Directory.CreateDirectory(tempPath);
192192

193-
await TestUtilities.RunGitCommand(tempPath, "init");
193+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
194194
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
195195
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
196196

@@ -237,7 +237,7 @@ public async Task LookupVersionLabel_FourComponentVersions_HandledCorrectly()
237237
{
238238
Directory.CreateDirectory(tempPath);
239239

240-
await TestUtilities.RunGitCommand(tempPath, "init");
240+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
241241
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
242242
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
243243

@@ -276,7 +276,7 @@ public async Task LookupVersionLabel_MaxValueVersionComponents_HandledCorrectly(
276276
{
277277
Directory.CreateDirectory(tempPath);
278278

279-
await TestUtilities.RunGitCommand(tempPath, "init");
279+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
280280
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
281281
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
282282

RelaxVersioner.Core.Tests/AnalyzerVersionComponentTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public async Task LookupVersionLabel_IncrementMajorOnly_IncrementsCorrectly()
2828
{
2929
Directory.CreateDirectory(tempPath);
3030

31-
await TestUtilities.RunGitCommand(tempPath, "init");
31+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
3232
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
3333
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
3434

@@ -67,7 +67,7 @@ public async Task LookupVersionLabel_IncrementTwoComponent_IncrementsMinor()
6767
{
6868
Directory.CreateDirectory(tempPath);
6969

70-
await TestUtilities.RunGitCommand(tempPath, "init");
70+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
7171
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
7272
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
7373

@@ -105,7 +105,7 @@ public async Task LookupVersionLabel_IncrementThreeComponent_IncrementsBuild()
105105
{
106106
Directory.CreateDirectory(tempPath);
107107

108-
await TestUtilities.RunGitCommand(tempPath, "init");
108+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
109109
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
110110
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
111111

@@ -143,7 +143,7 @@ public async Task LookupVersionLabel_IncrementFourComponent_IncrementsRevision()
143143
{
144144
Directory.CreateDirectory(tempPath);
145145

146-
await TestUtilities.RunGitCommand(tempPath, "init");
146+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
147147
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
148148
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
149149

@@ -181,7 +181,7 @@ public async Task LookupVersionLabel_ZeroComponentValues_HandledCorrectly()
181181
{
182182
Directory.CreateDirectory(tempPath);
183183

184-
await TestUtilities.RunGitCommand(tempPath, "init");
184+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
185185
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
186186
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
187187

@@ -219,7 +219,7 @@ public async Task LookupVersionLabel_MultipleIncrementsFromSameBase_AccumulatesC
219219
{
220220
Directory.CreateDirectory(tempPath);
221221

222-
await TestUtilities.RunGitCommand(tempPath, "init");
222+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
223223
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
224224
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
225225

@@ -261,7 +261,7 @@ public async Task LookupVersionLabel_MixedComponentCounts_ChoosesLargestCorrectl
261261
{
262262
Directory.CreateDirectory(tempPath);
263263

264-
await TestUtilities.RunGitCommand(tempPath, "init");
264+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
265265
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
266266
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
267267

@@ -300,7 +300,7 @@ public async Task LookupVersionLabel_EdgeCaseVersionComparisons_HandledCorrectly
300300
{
301301
Directory.CreateDirectory(tempPath);
302302

303-
await TestUtilities.RunGitCommand(tempPath, "init");
303+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
304304
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
305305
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
306306

@@ -339,7 +339,7 @@ public async Task LookupVersionLabel_LargeComponentValues_HandledCorrectly()
339339
{
340340
Directory.CreateDirectory(tempPath);
341341

342-
await TestUtilities.RunGitCommand(tempPath, "init");
342+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
343343
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
344344
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
345345

RelaxVersioner.Core.Tests/Analyzer_WorkingDirectory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public async Task LookupVersionLabelWithWorkingDirectoryChanges()
2929
Directory.CreateDirectory(tempPath);
3030

3131
// Initialize git repository
32-
await TestUtilities.RunGitCommand(tempPath, "init");
32+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
3333
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
3434
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
3535

@@ -122,7 +122,7 @@ public async Task LookupVersionLabelWithInitialRepository()
122122
Directory.CreateDirectory(tempPath);
123123

124124
// Initialize empty git repository
125-
await TestUtilities.RunGitCommand(tempPath, "init");
125+
await TestUtilities.InitializeGitRepositoryWithMainBranch(tempPath);
126126
await TestUtilities.RunGitCommand(tempPath, "config user.email \"[email protected]\"");
127127
await TestUtilities.RunGitCommand(tempPath, "config user.name \"Test User\"");
128128

0 commit comments

Comments
 (0)