mirror of
https://github.com/samsonjs/Peekaboo.git
synced 2026-04-27 15:07:41 +00:00
Fix Swift tests after error handling improvements
This commit is contained in:
parent
94c09b1c7a
commit
ebbb75ef1b
4 changed files with 18 additions and 22 deletions
|
|
@ -63,6 +63,7 @@ If all checks pass, follow the manual steps below.
|
||||||
|
|
||||||
2. **Actual NPM Publish:**
|
2. **Actual NPM Publish:**
|
||||||
- If the dry run is satisfactory, proceed with the actual publish command.
|
- If the dry run is satisfactory, proceed with the actual publish command.
|
||||||
|
- Use tag "beta" if the version is a beta, else omit tag to do a release version.
|
||||||
- `npm publish --access public --tag <your_tag>`
|
- `npm publish --access public --tag <your_tag>`
|
||||||
|
|
||||||
## Post-Publish Steps
|
## Post-Publish Steps
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,10 @@ final class ListCommandTests: XCTestCase {
|
||||||
|
|
||||||
func testListCommandSubcommands() throws {
|
func testListCommandSubcommands() throws {
|
||||||
// Test that ListCommand has the expected subcommands
|
// Test that ListCommand has the expected subcommands
|
||||||
XCTAssertEqual(ListCommand.configuration.subcommands.count, 2)
|
XCTAssertEqual(ListCommand.configuration.subcommands.count, 3)
|
||||||
XCTAssertTrue(ListCommand.configuration.subcommands.contains { $0 == AppsSubcommand.self })
|
XCTAssertTrue(ListCommand.configuration.subcommands.contains { $0 == AppsSubcommand.self })
|
||||||
XCTAssertTrue(ListCommand.configuration.subcommands.contains { $0 == WindowsSubcommand.self })
|
XCTAssertTrue(ListCommand.configuration.subcommands.contains { $0 == WindowsSubcommand.self })
|
||||||
|
XCTAssertTrue(ListCommand.configuration.subcommands.contains { $0 == ServerStatusSubcommand.self })
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAppsSubcommandParsing() throws {
|
func testAppsSubcommandParsing() throws {
|
||||||
|
|
|
||||||
|
|
@ -215,20 +215,20 @@ final class ModelsTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testCaptureErrorDescriptions() {
|
func testCaptureErrorDescriptions() {
|
||||||
XCTAssertEqual(CaptureError.noDisplaysAvailable.errorDescription, "No displays available for capture")
|
XCTAssertEqual(CaptureError.noDisplaysAvailable.errorDescription, "No displays available for capture.")
|
||||||
XCTAssertTrue(
|
XCTAssertTrue(
|
||||||
CaptureError.capturePermissionDenied.errorDescription!.contains("Screen recording permission denied")
|
CaptureError.screenRecordingPermissionDenied.errorDescription!.contains("Screen recording permission is required")
|
||||||
)
|
)
|
||||||
XCTAssertEqual(CaptureError.invalidDisplayID.errorDescription, "Invalid display ID")
|
XCTAssertEqual(CaptureError.invalidDisplayID.errorDescription, "Invalid display ID provided.")
|
||||||
XCTAssertEqual(CaptureError.captureCreationFailed.errorDescription, "Failed to create screen capture")
|
XCTAssertEqual(CaptureError.captureCreationFailed.errorDescription, "Failed to create the screen capture.")
|
||||||
XCTAssertEqual(CaptureError.windowNotFound.errorDescription, "Window not found")
|
XCTAssertEqual(CaptureError.windowNotFound.errorDescription, "The specified window could not be found.")
|
||||||
XCTAssertEqual(CaptureError.windowCaptureFailed.errorDescription, "Failed to capture window")
|
XCTAssertEqual(CaptureError.windowCaptureFailed.errorDescription, "Failed to capture the specified window.")
|
||||||
XCTAssertEqual(
|
XCTAssertEqual(
|
||||||
CaptureError.fileWriteError("/tmp/test.png").errorDescription,
|
CaptureError.fileWriteError("/tmp/test.png").errorDescription,
|
||||||
"Failed to write file to: /tmp/test.png"
|
"Failed to write capture file to path: /tmp/test.png."
|
||||||
)
|
)
|
||||||
XCTAssertEqual(CaptureError.appNotFound("Safari").errorDescription, "Application not found: Safari")
|
XCTAssertEqual(CaptureError.appNotFound("Safari").errorDescription, "Application with identifier 'Safari' not found or is not running.")
|
||||||
XCTAssertEqual(CaptureError.invalidWindowIndex(5).errorDescription, "Invalid window index: 5")
|
XCTAssertEqual(CaptureError.invalidWindowIndex(5).errorDescription, "Invalid window index: 5.")
|
||||||
}
|
}
|
||||||
|
|
||||||
func testWindowData() {
|
func testWindowData() {
|
||||||
|
|
|
||||||
|
|
@ -63,24 +63,18 @@ final class PermissionsCheckerTests: XCTestCase {
|
||||||
|
|
||||||
// MARK: - Permission State Tests
|
// MARK: - Permission State Tests
|
||||||
|
|
||||||
func testPermissionErrors() {
|
|
||||||
// Test permission error types
|
|
||||||
let screenError = PermissionError.screenRecordingDenied
|
|
||||||
let accessError = PermissionError.accessibilityDenied
|
|
||||||
|
|
||||||
XCTAssertNotNil(screenError)
|
|
||||||
XCTAssertNotNil(accessError)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Error Handling Tests
|
// MARK: - Error Handling Tests
|
||||||
|
|
||||||
func testCaptureError() {
|
func testCaptureError() {
|
||||||
// Test error creation for permission denied
|
// Test error creation for permission denied
|
||||||
let error = CaptureError.capturePermissionDenied
|
let screenError = CaptureError.screenRecordingPermissionDenied
|
||||||
|
let accessError = CaptureError.accessibilityPermissionDenied
|
||||||
|
|
||||||
// CaptureError conforms to LocalizedError, so it has errorDescription
|
// CaptureError conforms to LocalizedError, so it has errorDescription
|
||||||
XCTAssertNotNil(error.errorDescription)
|
XCTAssertNotNil(screenError.errorDescription)
|
||||||
XCTAssertTrue(error.errorDescription?.contains("permission") ?? false)
|
XCTAssertNotNil(accessError.errorDescription)
|
||||||
|
XCTAssertTrue(screenError.errorDescription?.contains("Screen recording permission") ?? false)
|
||||||
|
XCTAssertTrue(accessError.errorDescription?.contains("Accessibility permission") ?? false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Performance Tests
|
// MARK: - Performance Tests
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue