1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2026-03-31 08:50:07 +02:00

Fix tests, cleanup

This commit is contained in:
2025-09-25 16:33:10 +02:00
parent b6f27f0122
commit 8abd775eea
5 changed files with 41 additions and 13 deletions

View File

@@ -138,7 +138,14 @@ class TestableConfigurations {
: .instant(ShellStrings.shared.brewServicesAsRoot),
"/opt/homebrew/bin/brew services info --all --json"
: .instant(ShellStrings.shared.brewServicesAsUser),
"curl -s --max-time 10 '\(Constants.Urls.DevBuildCaskFile.absoluteString)'"
"""
curl -s --max-time 10 \
-H "User-Agent: phpmon \(App.shortVersion)" \
-H "X-phpmon-version: \(App.bundleVersion)" \
-H "X-phpmon-os-version: \(App.macVersion)" \
-H "X-phpmon-bundle-id: \(App.identifier)" \
'\(Constants.Urls.UpdateCheckEndpoint.absoluteString)'
"""
: .delayed(0.5, """
cask 'phpmon-dev' do
depends_on formula: 'gnu-sed'

View File

@@ -32,7 +32,14 @@ final class UpdateCheckTest: UITestCase {
// Ensure an update is available
configuration.shellOutput[
"curl -s --max-time 10 '\(Constants.Urls.DevBuildCaskFile.absoluteString)'"
"""
curl -s --max-time 10 \
-H "User-Agent: phpmon \(App.shortVersion)" \
-H "X-phpmon-version: \(App.bundleVersion)" \
-H "X-phpmon-os-version: \(App.macVersion)" \
-H "X-phpmon-bundle-id: \(App.identifier)" \
'\(Constants.Urls.UpdateCheckEndpoint.absoluteString)'
"""
] = .delayed(0.5, """
cask 'phpmon-dev' do
depends_on formula: 'gnu-sed'
@@ -64,7 +71,14 @@ final class UpdateCheckTest: UITestCase {
// Ensure an update is available
configuration.shellOutput[
"curl -s --max-time 10 '\(Constants.Urls.DevBuildCaskFile.absoluteString)'"
"""
curl -s --max-time 10 \
-H "User-Agent: phpmon \(App.shortVersion)" \
-H "X-phpmon-version: \(App.bundleVersion)" \
-H "X-phpmon-os-version: \(App.macVersion)" \
-H "X-phpmon-bundle-id: \(App.identifier)" \
'\(Constants.Urls.UpdateCheckEndpoint.absoluteString)'
"""
] = .delayed(0.5, """
cask 'phpmon-dev' do
depends_on formula: 'gnu-sed'
@@ -104,7 +118,14 @@ final class UpdateCheckTest: UITestCase {
// Ensure an update is available
configuration.shellOutput[
"curl -s --max-time 10 '\(Constants.Urls.DevBuildCaskFile.absoluteString)'"
"""
curl -s --max-time 10 \
-H "User-Agent: phpmon \(App.shortVersion)" \
-H "X-phpmon-version: \(App.bundleVersion)" \
-H "X-phpmon-os-version: \(App.macVersion)" \
-H "X-phpmon-bundle-id: \(App.identifier)" \
'\(Constants.Urls.UpdateCheckEndpoint.absoluteString)'
"""
] = .delayed(0.5, "404 PAGE NOT FOUND")
// Wait for the menu to open and search for updates

View File

@@ -40,7 +40,9 @@ class CaskFileParserTest: XCTestCase {
}
func test_can_extract_fields_from_remote_cask_file() async throws {
guard let caskFile = await CaskFile.from(url: Constants.Urls.StableBuildCaskFile) else {
let url = URL(string: "https://raw.githubusercontent.com/nicoverbruggen/homebrew-cask/master/Casks/phpmon.rb")!
guard let caskFile = await CaskFile.from(url: url) else {
return XCTFail("The remote CaskFile could not be parsed, check the log for more info")
}