Add notification setting to hide hellthreads
Changelog-Added: Add notification setting to hide hellthreads Closes: https://github.com/damus-io/damus/issues/2943 Signed-off-by: Terry Yiu <git@tyiu.xyz>
This commit is contained in:
50
damusTests/LargeEventTests.swift
Normal file
50
damusTests/LargeEventTests.swift
Normal file
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// LargeEventTests.swift
|
||||
// damusTests
|
||||
//
|
||||
// Created by William Casarin on 2023-08-05.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import damus
|
||||
|
||||
final class LargeEventTests: XCTestCase {
|
||||
|
||||
func testLongPost() throws {
|
||||
let json = "[\"EVENT\",\"subid\",\(test_failing_nostr_report)]"
|
||||
let resp = NostrResponse.owned_from_json(json: json)
|
||||
|
||||
XCTAssertNotNil(resp)
|
||||
guard let resp,
|
||||
case .event(let subid, let ev) = resp
|
||||
else {
|
||||
XCTAssertFalse(true)
|
||||
return
|
||||
}
|
||||
|
||||
XCTAssertEqual(subid, "subid")
|
||||
XCTAssertTrue(ev.should_show_event)
|
||||
XCTAssertTrue(!ev.too_big)
|
||||
XCTAssertTrue(should_show_event(state: test_damus_state, ev: ev))
|
||||
XCTAssertTrue(validate_event(ev: ev) == .ok)
|
||||
}
|
||||
|
||||
func testIsHellthread() throws {
|
||||
let json = "[\"EVENT\",\"subid\",\(test_failing_nostr_report)]"
|
||||
let resp = NostrResponse.owned_from_json(json: json)
|
||||
|
||||
XCTAssertNotNil(resp)
|
||||
guard let resp,
|
||||
case .event(let subid, let ev) = resp
|
||||
else {
|
||||
XCTAssertFalse(true)
|
||||
return
|
||||
}
|
||||
|
||||
XCTAssertEqual(subid, "subid")
|
||||
XCTAssertTrue(ev.should_show_event)
|
||||
XCTAssertTrue(ev.is_hellthread)
|
||||
XCTAssertTrue(validate_event(ev: ev) == .ok)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,12 +18,15 @@ final class LocalizationUtilTests: XCTestCase {
|
||||
["followers_count", "Followers", "Follower", "Followers"],
|
||||
["following_count", "Following", "Following", "Following"],
|
||||
["imports_count", "Imports", "Import", "Imports"],
|
||||
["hellthread_notification_settings", "Show notifications that mention more than 0 profiles", "Show notifications that mention more than 1 profile", "Show notifications that mention more than 2 profiles"],
|
||||
["quoted_reposts_count", "Quotes", "Quote", "Quotes"],
|
||||
["reactions_count", "Reactions", "Reaction", "Reactions"],
|
||||
["relays_count", "Relays", "Relay", "Relays"],
|
||||
["reposts_count", "Reposts", "Repost", "Reposts"],
|
||||
["sats", "sats", "sat", "sats"],
|
||||
["zaps_count", "Zaps", "Zap", "Zaps"],
|
||||
["word_count", "0 Words", "1 Word", "2 Words"]
|
||||
["users_talking_about_it", "0 users talking about it", "1 user talking about it", "2 users talking about it"],
|
||||
["word_count", "0 Words", "1 Word", "2 Words"],
|
||||
["zaps_count", "Zaps", "Zap", "Zaps"]
|
||||
]
|
||||
|
||||
for key in keys {
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
//
|
||||
// LongPostTests.swift
|
||||
// damusTests
|
||||
//
|
||||
// Created by William Casarin on 2023-08-05.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import damus
|
||||
|
||||
final class LongPostTests: XCTestCase {
|
||||
|
||||
override func setUpWithError() throws {
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
func testLongPost() throws {
|
||||
let contacts = Contacts(our_pubkey: test_keypair.pubkey)
|
||||
let json = "[\"EVENT\",\"subid\",\(test_failing_nostr_report)]"
|
||||
let resp = NostrResponse.owned_from_json(json: json)
|
||||
|
||||
XCTAssertNotNil(resp)
|
||||
guard let resp,
|
||||
case .event(let subid, let ev) = resp
|
||||
else {
|
||||
XCTAssertFalse(true)
|
||||
return
|
||||
}
|
||||
|
||||
XCTAssertEqual(subid, "subid")
|
||||
XCTAssertTrue(ev.should_show_event)
|
||||
XCTAssertTrue(!ev.too_big)
|
||||
XCTAssertTrue(should_show_event(state: test_damus_state, ev: ev))
|
||||
XCTAssertTrue(validate_event(ev: ev) == .ok )
|
||||
}
|
||||
|
||||
func testPerformanceExample() throws {
|
||||
// This is an example of a performance test case.
|
||||
self.measure {
|
||||
// Put the code you want to measure the time of here.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user