Files
damus/damusTests/Mocking/MockDamusState.swift
Charlie Fish f341a37902 mute: migrating muted_threads to new mute list
This patch depends on: Adding ability to mute hashtag from SearchView

This is the last patch for the new mute list feature

- Removing MutedThreadsManager
- Adding system to migrate existing muted threads to new mute list

Closes: https://github.com/damus-io/damus/issues/1718
Closes: https://github.com/damus-io/damus/issues/856
Lighting Address: fishcharlie@strike.me
Signed-off-by: Charlie Fish <contact@charlie.fish>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2024-01-22 12:55:03 -08:00

55 lines
2.0 KiB
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.
//
// MockDamusState.swift
// damusTests
//
// Created by Daniel DAquino on 2023-10-13.
//
import Foundation
@testable import damus
// Generates a test damus state with configurable mock parameters
func generate_test_damus_state(
mock_profile_info: [Pubkey: Profile]?
) -> DamusState {
// Create a unique temporary directory
let ndb = Ndb.test
let our_pubkey = test_pubkey
let pool = RelayPool(ndb: ndb)
let settings = UserSettingsStore()
let profiles: Profiles = {
guard let mock_profile_info, let profiles: Profiles = MockProfiles(mocked_profiles: mock_profile_info, ndb: ndb) else {
return Profiles.init(ndb: ndb)
}
return profiles
}()
let damus = DamusState(pool: pool,
keypair: test_keypair,
likes: .init(our_pubkey: our_pubkey),
boosts: .init(our_pubkey: our_pubkey),
contacts: .init(our_pubkey: our_pubkey),
profiles: profiles,
dms: .init(our_pubkey: our_pubkey),
previews: .init(),
zaps: .init(our_pubkey: our_pubkey),
lnurls: .init(),
settings: settings,
relay_filters: .init(our_pubkey: our_pubkey),
relay_model_cache: .init(),
drafts: .init(),
events: .init(ndb: ndb),
bookmarks: .init(pubkey: our_pubkey),
postbox: .init(pool: pool),
bootstrap_relays: .init(),
replies: .init(our_pubkey: our_pubkey),
wallet: .init(settings: settings),
nav: .init(),
music: .init(onChange: {_ in }),
video: .init(),
ndb: ndb)
return damus
}