mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-25 14:57:37 +00:00
- Updated macOS test bundle IDs to use consistent naming pattern: - sh.vibetunnel.vibetunnelTests → sh.vibetunnel.vibetunnel.tests - sh.vibetunnel.vibetunnelTests.debug → sh.vibetunnel.vibetunnel.tests.debug - Updated iOS test bundle ID: - sh.vibetunnel.VibeTunnelTests-Mobile → sh.vibetunnel.ios.tests - Fixed iOS logging to use sh.vibetunnel.ios subsystem consistently - Created logging configuration profile in apple/logging/ to enable full debug logging - Configuration profile covers all VibeTunnel subsystems and bundle IDs - Updated documentation to reflect new bundle identifiers and logging setup |
||
|---|---|---|
| .. | ||
| Mocks | ||
| Models | ||
| Services | ||
| Utilities | ||
| Utils | ||
| ViewModels | ||
| APIErrorTests.swift | ||
| AuthenticationTests.swift | ||
| EdgeCaseTests.swift | ||
| FileSystemTests.swift | ||
| PerformanceTests.swift | ||
| README.md | ||
| SessionListViewModelTests.swift | ||
| StandaloneTests.swift | ||
| TerminalParsingTests.swift | ||
| TestCoverage.md | ||
| TestingApproach.md | ||
| VibeTunnelTests.swift | ||
| WebSocketReconnectionTests.swift | ||
VibeTunnel iOS Tests
This directory contains the test suite for the VibeTunnel iOS application using Swift Testing framework.
Test Structure
VibeTunnelTests/
├── Mocks/ # Mock implementations for testing
│ ├── MockAPIClient.swift
│ ├── MockURLProtocol.swift
│ └── MockWebSocketTask.swift
├── Services/ # Service layer tests
│ ├── APIClientTests.swift
│ ├── BufferWebSocketClientTests.swift
│ └── ConnectionManagerTests.swift
├── Models/ # Data model tests
│ ├── SessionTests.swift
│ └── ServerConfigTests.swift
├── Utilities/ # Test utilities
│ ├── TestFixtures.swift
│ └── TestTags.swift
└── Integration/ # Integration tests (future)
Running Tests
Command Line
cd ios
swift test
Xcode
- Open
VibeTunnel.xcodeproj - Select the VibeTunnel scheme
- Press
Cmd+Uor choose Product → Test
CI
Tests run automatically in GitHub Actions on every push and pull request.
Test Tags
Tests are organized with tags for selective execution:
@Tag.critical- Core functionality tests@Tag.networking- Network-related tests@Tag.websocket- WebSocket functionality@Tag.models- Data model tests@Tag.persistence- Data persistence tests@Tag.integration- Integration tests
Run specific tags:
swift test --filter .critical
swift test --filter .networking
Writing Tests
This project uses Swift Testing (not XCTest). Key differences:
- Use
@Testattribute instead oftestprefix - Use
#expect()instead ofXCTAssert - Use
@Suiteto group related tests - Tests run in parallel by default
Example:
@Suite("MyFeature Tests", .tags(.critical))
struct MyFeatureTests {
@Test("Does something correctly")
func testFeature() async throws {
// Arrange
let sut = MyFeature()
// Act
let result = try await sut.doSomething()
// Assert
#expect(result == expectedValue)
}
}
Coverage Goals
- APIClient: 90%+
- BufferWebSocketClient: 85%+
- Models: 95%+
- Overall: 80%+