1
0
mirror of git://jb55.com/damus synced 2024-09-30 08:50:42 +00:00
damus/damusTests/Mocking/MockProfiles.swift
William Casarin 838ce26c64 test: fix test build error
Signed-off-by: William Casarin <jb55@jb55.com>
2024-01-28 15:43:13 -08:00

29 lines
738 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// MockProfiles.swift
// damusTests
//
// Created by Daniel DAquino on 2023-10-13.
//
import Foundation
@testable import damus
// A Mockable `Profiles` class that can be used for testing.
// Note: Not all methods are mocked. You might need to implement a method depending on the test you are writing.
class MockProfiles: Profiles {
var mocked_profiles: [Pubkey: Profile] = [:]
var ndb: Ndb
init?(mocked_profiles: [Pubkey : Profile], ndb: Ndb) {
self.mocked_profiles = mocked_profiles
self.ndb = ndb
super.init(ndb: ndb)
}
func lookup(id: Pubkey) -> NdbTxn<Profile?>? {
return NdbTxn(ndb: self.ndb) { txn in
return self.mocked_profiles[id]
}
}
}