Fixes #614 - Add the user and device identifiers to rageshakes (#620)

* Fixes #614 - Add the user and device identifiers to rageshakes

* Add `base_bundle_identifier` to rageshakes
This commit is contained in:
Stefan Ceriu
2023-02-24 14:51:36 +02:00
committed by GitHub
parent 252a5f2bdc
commit a3abde9e23
15 changed files with 79 additions and 23 deletions
@@ -26,7 +26,9 @@ class BugReportServiceTests: XCTestCase {
}
func testSubmitBugReportWithMockService() async throws {
let bugReport = BugReport(text: "i cannot send message",
let bugReport = BugReport(userID: "@mock:client.com",
deviceID: nil,
text: "i cannot send message",
includeLogs: true,
includeCrashLog: true,
githubLabels: [],
@@ -49,7 +51,9 @@ class BugReportServiceTests: XCTestCase {
applicationId: "mock_app_id",
session: .mock)
let bugReport = BugReport(text: "i cannot send message",
let bugReport = BugReport(userID: "@mock:client.com",
deviceID: nil,
text: "i cannot send message",
includeLogs: true,
includeCrashLog: true,
githubLabels: [],
@@ -21,25 +21,36 @@ import XCTest
@MainActor
class BugReportViewModelTests: XCTestCase {
func testInitialState() {
let viewModel = BugReportViewModel(bugReportService: MockBugReportService(), screenshot: nil, isModallyPresented: false)
let viewModel = BugReportViewModel(bugReportService: MockBugReportService(),
userID: "@mock.client.com",
deviceID: nil,
screenshot: nil,
isModallyPresented: false)
let context = viewModel.context
XCTAssertEqual(context.reportText, "")
XCTAssertNil(context.viewState.screenshot)
XCTAssertTrue(context.sendingLogsEnabled)
}
func testClearScreenshot() async throws {
let viewModel = BugReportViewModel(bugReportService: MockBugReportService(), screenshot: UIImage.actions, isModallyPresented: false)
let viewModel = BugReportViewModel(bugReportService: MockBugReportService(),
userID: "@mock.client.com",
deviceID: nil,
screenshot: UIImage.actions,
isModallyPresented: false)
let context = viewModel.context
context.send(viewAction: .removeScreenshot)
try await Task.sleep(nanoseconds: 100_000_000)
XCTAssertNil(context.viewState.screenshot)
}
func testAttachScreenshot() async throws {
let viewModel = BugReportViewModel(bugReportService: MockBugReportService(), screenshot: nil, isModallyPresented: false)
let viewModel = BugReportViewModel(bugReportService: MockBugReportService(),
userID: "@mock.client.com",
deviceID: nil,
screenshot: nil, isModallyPresented: false)
let context = viewModel.context
XCTAssertNil(context.viewState.screenshot)
context.send(viewAction: .attachScreenshot(UIImage.actions))