Commit fec094a2da
fec094a2da456d9094f6f0b06405a53f321b6d10
parent: 9e45c1d099
Unsigned
cmc <hello@cleberg.net> · 2026-04-12 04:36 UTC
Fix stale tests for current Swift concurrency model
Layout: unified · split
HutchTests/HomeViewModelTests.swift
+10 −1
| @@ -22,10 +22,19 @@ struct HomeViewModelTests { |
| 22 | 22 | func matchesCurrentUserAssigneeNormalizesCanonicalNameAndUsername() { |
| 23 | 23 | let currentUser = User( |
| 24 | 24 | id: 42, |
| 25 | created: nil, |
| 26 | updated: nil, |
| 25 | 27 | username: "owner", |
| 26 | 28 | canonicalName: "~owner", |
| 27 | 29 | email: "owner@example.com", |
| 28 | | avatar: nil |
| 30 | url: nil, |
| 31 | location: nil, |
| 32 | bio: nil, |
| 33 | avatar: nil, |
| 34 | pronouns: nil, |
| 35 | userType: nil, |
| 36 | receivesPaidServices: nil, |
| 37 | suspensionNotice: nil |
| 29 | 38 | ) |
| 30 | 39 | |
| 31 | 40 | #expect(HomeViewModel.matchesCurrentUserAssignee(Entity(canonicalName: "~owner"), currentUser: currentUser)) |
HutchTests/ProjectTests.swift
+2
| @@ -12,6 +12,7 @@ struct ProjectTests { |
| 12 | 12 | website: nil, |
| 13 | 13 | visibility: .public, |
| 14 | 14 | tags: [], |
| 15 | updated: Date(timeIntervalSince1970: 0), |
| 15 | 16 | mailingLists: [ |
| 16 | 17 | Project.MailingList( |
| 17 | 18 | id: "list-1", |
| @@ -62,6 +63,7 @@ struct ProjectTests { |
| 62 | 63 | website: "https://example.com", |
| 63 | 64 | visibility: .public, |
| 64 | 65 | tags: [], |
| 66 | updated: Date(timeIntervalSince1970: 0), |
| 65 | 67 | mailingLists: [], |
| 66 | 68 | sources: [], |
| 67 | 69 | trackers: [] |
HutchTests/RepositorySettingsViewModelTests.swift
+5 −3
| @@ -33,6 +33,7 @@ struct RepositorySettingsViewModelTests { |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | @Test |
| 36 | @MainActor |
| 36 | 37 | func gitCanonicalEntityAddsMissingTilde() { |
| 37 | 38 | #expect(RepositorySettingsViewModel.gitCanonicalEntity(from: "alice") == "~alice") |
| 38 | 39 | #expect(RepositorySettingsViewModel.gitCanonicalEntity(from: "~alice") == "~alice") |
| @@ -40,6 +41,7 @@ struct RepositorySettingsViewModelTests { |
| 40 | 41 | } |
| 41 | 42 | |
| 42 | 43 | @Test |
| 44 | @MainActor |
| 43 | 45 | func gitHeadReferenceUsesFullBranchRef() { |
| 44 | 46 | #expect(RepositorySettingsViewModel.gitHeadReference(from: "main") == "refs/heads/main") |
| 45 | 47 | #expect(RepositorySettingsViewModel.gitHeadReference(from: " refs/heads/dev ") == "refs/heads/dev") |
| @@ -50,7 +52,7 @@ struct RepositorySettingsViewModelTests { |
| 50 | 52 | func unchangedHeadIsOmittedFromSaveInput() { |
| 51 | 53 | let viewModel = RepositorySettingsViewModel( |
| 52 | 54 | repository: makeRepository(headName: "refs/heads/main"), |
| 53 | | branches: [Reference(name: "refs/heads/main", target: nil)], |
| 55 | branches: [ReferenceDetail(name: "refs/heads/main", target: nil, date: nil)], |
| 54 | 56 | client: SRHTClient(token: "test-token") |
| 55 | 57 | ) |
| 56 | 58 | |
| @@ -63,8 +65,8 @@ struct RepositorySettingsViewModelTests { |
| 63 | 65 | let viewModel = RepositorySettingsViewModel( |
| 64 | 66 | repository: makeRepository(headName: "refs/heads/main"), |
| 65 | 67 | branches: [ |
| 66 | | Reference(name: "refs/heads/main", target: nil), |
| 67 | | Reference(name: "refs/heads/dev", target: nil) |
| 68 | ReferenceDetail(name: "refs/heads/main", target: nil, date: nil), |
| 69 | ReferenceDetail(name: "refs/heads/dev", target: nil, date: nil) |
| 68 | 70 | ], |
| 69 | 71 | client: SRHTClient(token: "test-token") |
| 70 | 72 | ) |
HutchTests/TrackerManagementViewModelTests.swift
+2
| @@ -4,12 +4,14 @@ import Testing |
| 4 | 4 | struct TrackerManagementViewModelTests { |
| 5 | 5 | |
| 6 | 6 | @Test |
| 7 | @MainActor |
| 7 | 8 | func normalizedUsernameStripsLeadingTildeAndWhitespace() { |
| 8 | 9 | #expect(TrackerManagementViewModel.normalizedUsername(" ~alice ") == "alice") |
| 9 | 10 | #expect(TrackerManagementViewModel.normalizedUsername("bob") == "bob") |
| 10 | 11 | } |
| 11 | 12 | |
| 12 | 13 | @Test |
| 14 | @MainActor |
| 13 | 15 | func hexColorValidationRequiresPoundAndSixHexDigits() { |
| 14 | 16 | #expect(TrackerManagementViewModel.isValidHexColor("#a1B2c3")) |
| 15 | 17 | #expect(!TrackerManagementViewModel.isValidHexColor("a1B2c3")) |