TestWikiCheckout verifies wiki: true support across parsing, deduplication, and step generation.
(t *testing.T)
| 1319 | |
| 1320 | // TestWikiCheckout verifies wiki: true support across parsing, deduplication, and step generation. |
| 1321 | func TestWikiCheckout(t *testing.T) { |
| 1322 | getPin := func(action string) string { return action + "@v4" } |
| 1323 | |
| 1324 | t.Run("parse wiki true", func(t *testing.T) { |
| 1325 | raw := map[string]any{ |
| 1326 | "repository": "owner/repo", |
| 1327 | "wiki": true, |
| 1328 | } |
| 1329 | configs, err := ParseCheckoutConfigs(raw) |
| 1330 | require.NoError(t, err, "should parse wiki: true without error") |
| 1331 | require.Len(t, configs, 1, "should produce one config") |
| 1332 | assert.True(t, configs[0].Wiki, "wiki field should be true") |
| 1333 | }) |
| 1334 | |
| 1335 | t.Run("parse wiki false", func(t *testing.T) { |
| 1336 | raw := map[string]any{ |
| 1337 | "repository": "owner/repo", |
| 1338 | "wiki": false, |
| 1339 | } |
| 1340 | configs, err := ParseCheckoutConfigs(raw) |
| 1341 | require.NoError(t, err, "should parse wiki: false without error") |
| 1342 | require.Len(t, configs, 1, "should produce one config") |
| 1343 | assert.False(t, configs[0].Wiki, "wiki field should be false") |
| 1344 | }) |
| 1345 | |
| 1346 | t.Run("wiki must be boolean", func(t *testing.T) { |
| 1347 | raw := map[string]any{ |
| 1348 | "wiki": "yes", |
| 1349 | } |
| 1350 | _, err := ParseCheckoutConfigs(raw) |
| 1351 | require.Error(t, err, "non-boolean wiki should return error") |
| 1352 | assert.Contains(t, err.Error(), "checkout.wiki must be a boolean", "error message should mention wiki") |
| 1353 | }) |
| 1354 | |
| 1355 | t.Run("parse force-clean-git-credentials true", func(t *testing.T) { |
| 1356 | raw := map[string]any{ |
| 1357 | "force-clean-git-credentials": true, |
| 1358 | } |
| 1359 | configs, err := ParseCheckoutConfigs(raw) |
| 1360 | require.NoError(t, err, "should parse force-clean-git-credentials: true without error") |
| 1361 | require.Len(t, configs, 1, "should produce one config") |
| 1362 | assert.True(t, configs[0].CleanGitCredentials, "force-clean-git-credentials should be true") |
| 1363 | }) |
| 1364 | |
| 1365 | t.Run("force-clean-git-credentials must be boolean", func(t *testing.T) { |
| 1366 | raw := map[string]any{ |
| 1367 | "force-clean-git-credentials": "true", |
| 1368 | } |
| 1369 | _, err := ParseCheckoutConfigs(raw) |
| 1370 | require.Error(t, err, "non-boolean force-clean-git-credentials should return error") |
| 1371 | assert.Contains(t, err.Error(), "checkout.force-clean-git-credentials must be a boolean", "error message should mention force-clean-git-credentials") |
| 1372 | }) |
| 1373 | |
| 1374 | t.Run("wiki and non-wiki checkouts of same repo and path are not merged", func(t *testing.T) { |
| 1375 | cm := NewCheckoutManager([]*CheckoutConfig{ |
| 1376 | {Repository: "owner/repo", Path: "./wiki", Wiki: true}, |
| 1377 | {Repository: "owner/repo", Path: "./wiki", Wiki: false}, |
| 1378 | }) |
nothing calls this directly
no test coverage detected