vibetunnel/ios/VibeTunnelTests
Peter Steinberger 80e7e1c07a fixes test
2025-06-25 02:11:51 +02:00
..
Integration iOS: add tests 2025-06-23 14:58:11 +02:00
Mocks ios test fixes 2025-06-24 00:07:45 +02:00
Models Add comprehensive server tests and switch to Biome linter (#73) 2025-06-24 18:51:38 +02:00
Services fixes test 2025-06-25 02:11:51 +02:00
TestUtilities iOS: add tests 2025-06-23 14:58:11 +02:00
Utilities Add comprehensive server tests and switch to Biome linter (#73) 2025-06-24 18:51:38 +02:00
Utils iOS: add tests 2025-06-23 14:58:11 +02:00
ViewModels iOS: add tests 2025-06-23 14:58:11 +02:00
APIErrorTests.swift Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
AuthenticationTests.swift iOS: add tests 2025-06-23 14:58:11 +02:00
EdgeCaseTests.swift Add comprehensive server tests and switch to Biome linter (#73) 2025-06-24 18:51:38 +02:00
FileSystemTests.swift Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
PerformanceTests.swift Add comprehensive server tests and switch to Biome linter (#73) 2025-06-24 18:51:38 +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 fix warning 2025-06-25 02:11:51 +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%+