Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
philipphofmann committed Jan 30, 2024
1 parent 0c8652a commit bf7ab00
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Tests/SentryTests/Helper/SentryFileManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ class SentryFileManagerTests: XCTestCase {

sut.deleteOldEnvelopeItems()

let logMessages = logOutput.loggedMessages.filter { $0.contains("Ignoring .DS_Store file when building envelopes path at path: \(dsStoreFile)") }
let logMessages = logOutput.loggedMessages.filter {
$0.contains("[Sentry] [debug]") &&
$0.contains("Ignoring .DS_Store file when building envelopes path at path: \(dsStoreFile)")
}
expect(logMessages.count) == 1

try FileManager.default.removeItem(atPath: dsStoreFile)
Expand All @@ -177,7 +180,10 @@ class SentryFileManagerTests: XCTestCase {

sut.deleteOldEnvelopeItems()

let logMessages = logOutput.loggedMessages.filter { $0.contains("Ignoring non directory when deleting old envelopes at path: \(textFilePath)") }
let logMessages = logOutput.loggedMessages.filter {
$0.contains("[Sentry] [debug]") &&
$0.contains("Ignoring non directory when deleting old envelopes at path: \(textFilePath)")
}
expect(logMessages.count) == 1

try FileManager.default.removeItem(atPath: textFilePath)
Expand All @@ -195,7 +201,10 @@ class SentryFileManagerTests: XCTestCase {

expect(sut.getEnvelopesPath(nonExistentFile)) == nil

let logMessages = logOutput.loggedMessages.filter { $0.contains("Could not get attributes of item at path: \(nonExistentFileFullPath)") }
let logMessages = logOutput.loggedMessages.filter {
$0.contains("[Sentry] [warning]") &&
$0.contains("Could not get attributes of item at path: \(nonExistentFileFullPath)")
}
expect(logMessages.count) == 1
}

Expand Down

0 comments on commit bf7ab00

Please sign in to comment.