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

import Foundation
@testable import MullvadREST
import MullvadTypes

/// 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 {}
}