From c2892626d7679aaee6872afe20f3b7bdc99c8c09 Mon Sep 17 00:00:00 2001 From: Ross Goldberg <484615+rgoldberg@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:13:29 -0400 Subject: [PATCH] Fix search & uninstall tests. Partial #592 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com> --- Tests/masTests/Commands/SearchSpec.swift | 7 +++++-- Tests/masTests/Commands/UninstallSpec.swift | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Tests/masTests/Commands/SearchSpec.swift b/Tests/masTests/Commands/SearchSpec.swift index 2496ad0..91a3a45 100644 --- a/Tests/masTests/Commands/SearchSpec.swift +++ b/Tests/masTests/Commands/SearchSpec.swift @@ -6,6 +6,7 @@ // Copyright © 2018 mas-cli. All rights reserved. // +import Foundation import Nimble import Quick @@ -31,9 +32,11 @@ public class SearchSpec: QuickSpec { ) storeSearch.apps[mockResult.trackId] = mockResult expect { - try Mas.Search.parse(["slack"]).run(storeSearch: storeSearch) + try captureStream(stdout) { + try Mas.Search.parse(["slack"]).run(storeSearch: storeSearch) + } } - .toNot(throwError()) + == " 1111 slack (0.0)\n" } it("fails when searching for nonexistent app") { expect { diff --git a/Tests/masTests/Commands/UninstallSpec.swift b/Tests/masTests/Commands/UninstallSpec.swift index 13613b8..bf5890f 100644 --- a/Tests/masTests/Commands/UninstallSpec.swift +++ b/Tests/masTests/Commands/UninstallSpec.swift @@ -67,7 +67,7 @@ public class UninstallSpec: QuickSpec { try uninstall.run(appLibrary: mockLibrary) } } - == " 1111 slack (0.0)\n==> Some App /tmp/Some.app\n==> (not removed, dry run)\n" + == "==> Some App /tmp/Some.app\n==> (not removed, dry run)\n" } it("fails if there is a problem with the trash command") { var brokenUninstall = app // make mutable copy