summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadRESTTests/Mocks/MemoryCache.swift
blob: e8a8c36fca96016f989f2011c427a58f0f32dc40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//
//  MemoryCache.swift
//  MullvadRESTTests
//
//  Created by pronebird on 25/08/2023.
//  Copyright © 2025 Mullvad VPN AB. All rights reserved.
//

import Foundation
import MullvadTypes

@testable import MullvadREST

/// Mock implementation of a static memory cache passed to `AddressCache`.
/// Since we don't do any actual networking in tests, the IP endpoint returned from cache is not important.
struct MemoryCache: FileCacheProtocol {
    func read() throws -> REST.StoredAddressCache {
        return .init(updatedAt: .distantFuture, endpoint: .ipv4(IPv4Endpoint(ip: .loopback, port: 80)))
    }

    func write(_ content: REST.StoredAddressCache) throws {}

    func clear() throws {}
}