vibetunnel/ios/VibeTunnelTests
2025-06-22 11:53:00 +02:00
..
Mocks Improve iOS tests 2025-06-22 11:53:00 +02:00
Models Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
Services Improve iOS tests 2025-06-22 11:53:00 +02:00
Utilities Fix iOS CI and enable test execution 2025-06-22 08:51:18 +02:00
APIErrorTests.swift Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
AuthenticationTests.swift Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
EdgeCaseTests.swift Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
FileSystemTests.swift Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
PerformanceTests.swift Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
README.md Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
StandaloneTests.swift Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
TerminalParsingTests.swift Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
TestCoverage.md Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
TestingApproach.md Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
VibeTunnelTests.swift Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
WebSocketReconnectionTests.swift Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00

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

  1. Open VibeTunnel.xcodeproj
  2. Select the VibeTunnel scheme
  3. Press Cmd+U or 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 @Test attribute instead of test prefix
  • Use #expect() instead of XCTAssert
  • Use @Suite to 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%+