Updated the 'MessageReceiverDisappearingMessagesSpec' to the updated pattern
This commit is contained in:
parent
bf58831313
commit
5b7c9d866c
|
@ -45,6 +45,7 @@ extension ProjectState {
|
|||
.contains("[UIImage imageNamed:"),
|
||||
.contains("UIFont(name:"),
|
||||
.contains(".accessibilityLabel ="),
|
||||
.contains(".accessibilityValue ="),
|
||||
.contains(".accessibilityIdentifier ="),
|
||||
.contains("accessibilityIdentifier:"),
|
||||
.contains("accessibilityLabel:"),
|
||||
|
|
|
@ -113,7 +113,6 @@
|
|||
7B521E0A29BFF84400C3C36A /* GroupLeavingJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B521E0929BFF84400C3C36A /* GroupLeavingJob.swift */; };
|
||||
7B5233C42900E90F00F8F375 /* SessionLabelCarouselView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B5233C32900E90F00F8F375 /* SessionLabelCarouselView.swift */; };
|
||||
7B5233C6290636D700F8F375 /* _017_DisappearingMessagesConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B5233C5290636D700F8F375 /* _017_DisappearingMessagesConfiguration.swift */; };
|
||||
7B6ACADE2A32D3A9009AFB73 /* MessageReceiverDisappearingMessagesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6ACADD2A32D3A9009AFB73 /* MessageReceiverDisappearingMessagesSpec.swift */; };
|
||||
7B7037432834B81F000DCF35 /* ReactionContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B7037422834B81F000DCF35 /* ReactionContainerView.swift */; };
|
||||
7B7037452834BCC0000DCF35 /* ReactionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B7037442834BCC0000DCF35 /* ReactionView.swift */; };
|
||||
7B71A98F2925E2A600E54854 /* SessionFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B71A98E2925E2A600E54854 /* SessionFooterView.swift */; };
|
||||
|
@ -810,6 +809,7 @@
|
|||
FDC438C927BB706500C60D73 /* SendDirectMessageRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC438C827BB706500C60D73 /* SendDirectMessageRequest.swift */; };
|
||||
FDC438CB27BB7DB100C60D73 /* UpdateMessageRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC438CA27BB7DB100C60D73 /* UpdateMessageRequest.swift */; };
|
||||
FDC438CD27BC641200C60D73 /* Set+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC438CC27BC641200C60D73 /* Set+Utilities.swift */; };
|
||||
FDC439632AC2492700A56963 /* MessageReceiverSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6ACADD2A32D3A9009AFB73 /* MessageReceiverSpec.swift */; };
|
||||
FDC498B72AC15F7D00EDD897 /* AppNotificationCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC498B62AC15F7D00EDD897 /* AppNotificationCategory.swift */; };
|
||||
FDC498B92AC15FE300EDD897 /* AppNotificationAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC498B82AC15FE300EDD897 /* AppNotificationAction.swift */; };
|
||||
FDC498BB2AC1606C00EDD897 /* AppNotificationUserInfoKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC498BA2AC1606C00EDD897 /* AppNotificationUserInfoKey.swift */; };
|
||||
|
@ -1242,7 +1242,7 @@
|
|||
7B521E0929BFF84400C3C36A /* GroupLeavingJob.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupLeavingJob.swift; sourceTree = "<group>"; };
|
||||
7B5233C32900E90F00F8F375 /* SessionLabelCarouselView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionLabelCarouselView.swift; sourceTree = "<group>"; };
|
||||
7B5233C5290636D700F8F375 /* _017_DisappearingMessagesConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = _017_DisappearingMessagesConfiguration.swift; sourceTree = "<group>"; };
|
||||
7B6ACADD2A32D3A9009AFB73 /* MessageReceiverDisappearingMessagesSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageReceiverDisappearingMessagesSpec.swift; sourceTree = "<group>"; };
|
||||
7B6ACADD2A32D3A9009AFB73 /* MessageReceiverSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageReceiverSpec.swift; sourceTree = "<group>"; };
|
||||
7B7037422834B81F000DCF35 /* ReactionContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReactionContainerView.swift; sourceTree = "<group>"; };
|
||||
7B7037442834BCC0000DCF35 /* ReactionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReactionView.swift; sourceTree = "<group>"; };
|
||||
7B71A98E2925E2A600E54854 /* SessionFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionFooterView.swift; sourceTree = "<group>"; };
|
||||
|
@ -2394,14 +2394,6 @@
|
|||
path = "Emoji Picker";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7B6ACADC2A32D38D009AFB73 /* MessagingKit */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7B6ACADD2A32D3A9009AFB73 /* MessageReceiverDisappearingMessagesSpec.swift */,
|
||||
);
|
||||
path = MessagingKit;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7B7CB18C270D06350079FF93 /* Views & Modals */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -3925,6 +3917,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
FD3C907027E445E500CD579F /* MessageReceiverDecryptionSpec.swift */,
|
||||
7B6ACADD2A32D3A9009AFB73 /* MessageReceiverSpec.swift */,
|
||||
FD3C906C27E43C4B00CD579F /* MessageSenderEncryptionSpec.swift */,
|
||||
);
|
||||
path = "Sending & Receiving";
|
||||
|
@ -3974,7 +3967,6 @@
|
|||
FD71160A28D00BAE00B47552 /* SessionTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7B6ACADC2A32D38D009AFB73 /* MessagingKit */,
|
||||
FD71161228D00D5300B47552 /* Conversations */,
|
||||
FD71161828D00E0100B47552 /* Settings */,
|
||||
);
|
||||
|
@ -6381,7 +6373,6 @@
|
|||
FD0969FA2A6A00B000C5C365 /* Mocked.swift in Sources */,
|
||||
FD23EA5C28ED00F80058676E /* Mock.swift in Sources */,
|
||||
FD23EA6128ED0B260058676E /* CombineExtensions.swift in Sources */,
|
||||
7B6ACADE2A32D3A9009AFB73 /* MessageReceiverDisappearingMessagesSpec.swift in Sources */,
|
||||
FDFE75B32ABD469500655640 /* MockJobRunner.swift in Sources */,
|
||||
FD9DD2712A72516D00ECB68E /* TestExtensions.swift in Sources */,
|
||||
FD2AAAED28ED3E1000A49611 /* MockGeneralCache.swift in Sources */,
|
||||
|
@ -6452,6 +6443,7 @@
|
|||
FDC2908B27D707F3005DAE71 /* SendMessageRequestSpec.swift in Sources */,
|
||||
FDC290A827D9B46D005DAE71 /* NimbleExtensions.swift in Sources */,
|
||||
FD7692F72A53A2ED000E4B70 /* SessionThreadViewModelSpec.swift in Sources */,
|
||||
FDC439632AC2492700A56963 /* MessageReceiverSpec.swift in Sources */,
|
||||
FD0969F92A69FFE700C5C365 /* Mocked.swift in Sources */,
|
||||
FDC2908F27D70938005DAE71 /* SendDirectMessageRequestSpec.swift in Sources */,
|
||||
FDC438BD27BB2AB400C60D73 /* Mockable.swift in Sources */,
|
||||
|
|
|
@ -6,69 +6,60 @@ import Quick
|
|||
import Nimble
|
||||
import SessionSnodeKit
|
||||
import SessionUtilitiesKit
|
||||
import SessionMessagingKit
|
||||
import SessionUIKit
|
||||
|
||||
@testable import Session
|
||||
@testable import SessionMessagingKit
|
||||
|
||||
class MessageReceiverDisappearingMessagesSpec: QuickSpec {
|
||||
// MARK: - Spec
|
||||
|
||||
override func spec() {
|
||||
var mockStorage: Storage!
|
||||
var mockProto: SNProtoContent!
|
||||
var mockMessage: VisibleMessage!
|
||||
class MessageReceiverSpec: QuickSpec {
|
||||
override class func spec() {
|
||||
// MARK: Configuration
|
||||
|
||||
@TestState var mockStorage: Storage! = SynchronousStorage(
|
||||
customWriter: try! DatabaseQueue(),
|
||||
customMigrationTargets: [
|
||||
SNUtilitiesKit.self,
|
||||
SNSnodeKit.self,
|
||||
SNMessagingKit.self,
|
||||
SNUIKit.self
|
||||
],
|
||||
initialData: { db in
|
||||
try SessionThread.fetchOrCreate(
|
||||
db,
|
||||
id: "TestId",
|
||||
variant: .contact,
|
||||
shouldBeVisible: true
|
||||
)
|
||||
}
|
||||
)
|
||||
@TestState var mockProto: SNProtoContent! = {
|
||||
let proto = SNProtoContent.builder()
|
||||
let dataMessage = SNProtoDataMessage.builder()
|
||||
proto.setExpirationType(.deleteAfterRead)
|
||||
proto.setExpirationTimer(UInt32(DisappearingMessagesConfiguration.DefaultDuration.disappearAfterRead.seconds))
|
||||
proto.setLastDisappearingMessageChangeTimestamp((1234567890 - (60 * 10)) * 1000)
|
||||
dataMessage.setBody("Test")
|
||||
proto.setDataMessage(try! dataMessage.build())
|
||||
return try? proto.build()
|
||||
}()
|
||||
@TestState var mockMessage: VisibleMessage! = {
|
||||
let result = VisibleMessage(
|
||||
sender: "TestId",
|
||||
sentTimestamp: ((1234567890 - (60 * 10)) * 1000),
|
||||
recipient: "05\(TestConstants.publicKey)",
|
||||
text: "Test"
|
||||
)
|
||||
result.receivedTimestamp = (1234567890 * 1000)
|
||||
return result
|
||||
}()
|
||||
@TestState var dependencies: Dependencies! = Dependencies(
|
||||
storage: mockStorage
|
||||
)
|
||||
|
||||
// MARK: - a MessageReceiver
|
||||
describe("a MessageReceiver") {
|
||||
|
||||
// MARK: - Configuration
|
||||
|
||||
beforeEach {
|
||||
mockStorage = SynchronousStorage(
|
||||
customWriter: try! DatabaseQueue(),
|
||||
customMigrationTargets: [
|
||||
SNUtilitiesKit.self,
|
||||
SNSnodeKit.self,
|
||||
SNMessagingKit.self,
|
||||
SNUIKit.self
|
||||
]
|
||||
)
|
||||
|
||||
let proto = SNProtoContent.builder()
|
||||
let dataMessage = SNProtoDataMessage.builder()
|
||||
proto.setExpirationType(.deleteAfterRead)
|
||||
proto.setExpirationTimer(UInt32(DisappearingMessagesConfiguration.DefaultDuration.disappearAfterRead.seconds))
|
||||
proto.setLastDisappearingMessageChangeTimestamp((1234567890 - (60 * 10)) * 1000)
|
||||
dataMessage.setBody("Test")
|
||||
proto.setDataMessage(try! dataMessage.build())
|
||||
mockProto = try? proto.build()
|
||||
|
||||
mockMessage = VisibleMessage(
|
||||
sender: "TestId",
|
||||
sentTimestamp: ((1234567890 - (60 * 10)) * 1000),
|
||||
recipient: "05\(TestConstants.publicKey)",
|
||||
text: "Test"
|
||||
)
|
||||
mockMessage.receivedTimestamp = (1234567890 * 1000)
|
||||
|
||||
mockStorage.write { db in
|
||||
try SessionThread.fetchOrCreate(
|
||||
db,
|
||||
id: "TestId",
|
||||
variant: .contact,
|
||||
shouldBeVisible: true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
afterEach {
|
||||
mockStorage = nil
|
||||
mockProto = nil
|
||||
}
|
||||
|
||||
// MARK: - when receiving an outdated disappearing message config update
|
||||
// MARK: -- when receiving an outdated disappearing message config update
|
||||
context("when receiving an outdated disappearing message config update") {
|
||||
// MARK: -- does NOT update local config
|
||||
// MARK: ---- does NOT update local config
|
||||
it("does NOT update local config") {
|
||||
let config: DisappearingMessagesConfiguration = DisappearingMessagesConfiguration
|
||||
.defaultWith("TestId")
|
||||
|
@ -102,9 +93,9 @@ class MessageReceiverDisappearingMessagesSpec: QuickSpec {
|
|||
}
|
||||
}
|
||||
|
||||
// MARK: - when receiving a newer disappearing message config update
|
||||
// MARK: -- when receiving a newer disappearing message config update
|
||||
context("when receiving a newer disappearing message config update") {
|
||||
// MARK: -- updates the local config properly
|
||||
// MARK: ---- updates the local config properly
|
||||
it("updates the local config properly") {
|
||||
mockStorage.write { db in
|
||||
do {
|
|
@ -36,6 +36,8 @@ class ThreadDisappearingMessagesSettingsViewModelSpec: QuickSpec {
|
|||
@TestState var viewModel: ThreadDisappearingMessagesSettingsViewModel! = ThreadDisappearingMessagesSettingsViewModel(
|
||||
threadId: "TestId",
|
||||
threadVariant: .contact,
|
||||
currentUserIsClosedGroupMember: nil,
|
||||
currentUserIsClosedGroupAdmin: nil,
|
||||
config: DisappearingMessagesConfiguration.defaultWith("TestId"),
|
||||
using: dependencies
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue