Add comprehensive iOS unit and UI test suites for greenfield test plan
- Create unit tests: DataLayerTests (27 tests for DATA-001–007), DataManagerExtendedTests (20 tests for TASK-005, TASK-012, TCOMP-003, THEME-001, QA-002), plus ValidationHelpers, TaskMetrics, StringExtensions, DoubleExtensions, DateUtils, DocumentHelpers, ErrorMessageParser - Create UI tests: AuthenticationTests, PasswordResetTests, OnboardingTests, TaskIntegration, ContractorIntegration, ResidenceIntegration, DocumentIntegration, DataLayer, Stability - Add UI test framework: AuthenticatedTestCase, ScreenObjects, TestFlows, TestAccountManager, TestAccountAPIClient, TestDataCleaner, TestDataSeeder - Add accessibility identifiers to password reset views for UI test support - Add greenfield test plan CSVs and update automated column for 27 test IDs - All 297 unit tests pass across 60 suites Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
115
iosApp/CaseraTests/DocumentHelpersTests.swift
Normal file
115
iosApp/CaseraTests/DocumentHelpersTests.swift
Normal file
@@ -0,0 +1,115 @@
|
||||
//
|
||||
// DocumentHelpersTests.swift
|
||||
// CaseraTests
|
||||
//
|
||||
// Unit tests for DocumentTypeHelper and DocumentCategoryHelper.
|
||||
//
|
||||
|
||||
import Testing
|
||||
@testable import Casera
|
||||
|
||||
// MARK: - DocumentTypeHelper Tests
|
||||
|
||||
struct DocumentTypeHelperTests {
|
||||
|
||||
@Test func warrantyDisplayName() {
|
||||
#expect(DocumentTypeHelper.displayName(for: "warranty") == "Warranty")
|
||||
}
|
||||
|
||||
@Test func manualDisplayName() {
|
||||
#expect(DocumentTypeHelper.displayName(for: "manual") == "User Manual")
|
||||
}
|
||||
|
||||
@Test func receiptDisplayName() {
|
||||
#expect(DocumentTypeHelper.displayName(for: "receipt") == "Receipt/Invoice")
|
||||
}
|
||||
|
||||
@Test func inspectionDisplayName() {
|
||||
#expect(DocumentTypeHelper.displayName(for: "inspection") == "Inspection Report")
|
||||
}
|
||||
|
||||
@Test func insuranceDisplayName() {
|
||||
#expect(DocumentTypeHelper.displayName(for: "insurance") == "Insurance")
|
||||
}
|
||||
|
||||
@Test func permitDisplayName() {
|
||||
#expect(DocumentTypeHelper.displayName(for: "permit") == "Permit")
|
||||
}
|
||||
|
||||
@Test func deedDisplayName() {
|
||||
#expect(DocumentTypeHelper.displayName(for: "deed") == "Deed/Title")
|
||||
}
|
||||
|
||||
@Test func contractDisplayName() {
|
||||
#expect(DocumentTypeHelper.displayName(for: "contract") == "Contract")
|
||||
}
|
||||
|
||||
@Test func photoDisplayName() {
|
||||
#expect(DocumentTypeHelper.displayName(for: "photo") == "Photo")
|
||||
}
|
||||
|
||||
@Test func unknownTypeDefaultsToOther() {
|
||||
#expect(DocumentTypeHelper.displayName(for: "unknown") == "Other")
|
||||
}
|
||||
|
||||
@Test func emptyTypeDefaultsToOther() {
|
||||
#expect(DocumentTypeHelper.displayName(for: "") == "Other")
|
||||
}
|
||||
|
||||
@Test func allTypesArrayNotEmpty() {
|
||||
#expect(!DocumentTypeHelper.allTypes.isEmpty)
|
||||
}
|
||||
|
||||
@Test func allTypesContainsWarranty() {
|
||||
#expect(DocumentTypeHelper.allTypes.contains("warranty"))
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - DocumentCategoryHelper Tests
|
||||
|
||||
struct DocumentCategoryHelperTests {
|
||||
|
||||
@Test func applianceDisplayName() {
|
||||
#expect(DocumentCategoryHelper.displayName(for: "appliance") == "Appliance")
|
||||
}
|
||||
|
||||
@Test func hvacDisplayName() {
|
||||
#expect(DocumentCategoryHelper.displayName(for: "hvac") == "HVAC")
|
||||
}
|
||||
|
||||
@Test func plumbingDisplayName() {
|
||||
#expect(DocumentCategoryHelper.displayName(for: "plumbing") == "Plumbing")
|
||||
}
|
||||
|
||||
@Test func electricalDisplayName() {
|
||||
#expect(DocumentCategoryHelper.displayName(for: "electrical") == "Electrical")
|
||||
}
|
||||
|
||||
@Test func roofingDisplayName() {
|
||||
#expect(DocumentCategoryHelper.displayName(for: "roofing") == "Roofing")
|
||||
}
|
||||
|
||||
@Test func structuralDisplayName() {
|
||||
#expect(DocumentCategoryHelper.displayName(for: "structural") == "Structural")
|
||||
}
|
||||
|
||||
@Test func landscapingDisplayName() {
|
||||
#expect(DocumentCategoryHelper.displayName(for: "landscaping") == "Landscaping")
|
||||
}
|
||||
|
||||
@Test func generalDisplayName() {
|
||||
#expect(DocumentCategoryHelper.displayName(for: "general") == "General")
|
||||
}
|
||||
|
||||
@Test func unknownCategoryDefaultsToOther() {
|
||||
#expect(DocumentCategoryHelper.displayName(for: "xyz") == "Other")
|
||||
}
|
||||
|
||||
@Test func allCategoriesArrayNotEmpty() {
|
||||
#expect(!DocumentCategoryHelper.allCategories.isEmpty)
|
||||
}
|
||||
|
||||
@Test func allCategoriesContainsHVAC() {
|
||||
#expect(DocumentCategoryHelper.allCategories.contains("hvac"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user