1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-11-07 21:20:07 +01:00

♻️ Migrate more tests to Swift Testing (2/?)

This commit is contained in:
2025-09-29 17:12:43 +02:00
parent 5b27d9f0ea
commit ceff52ed11
12 changed files with 119 additions and 133 deletions

View File

@@ -0,0 +1,55 @@
//
// CaskFileParserTest.swift
// Unit Tests
//
// Created by Nico Verbruggen on 04/02/2023.
// Copyright © 2023 Nico Verbruggen. All rights reserved.
//
import Testing
import Foundation
struct CaskFileParserTest {
// MARK: - Test Files
static var exampleFilePath: URL {
TestBundle.url(forResource: "phpmon-dev", withExtension: "rb")!
}
@Test func can_extract_fields_from_cask_file() async throws {
guard let caskFile = await CaskFile.from(url: CaskFileParserTest.exampleFilePath) else {
Issue.record("The CaskFile could not be parsed, check the log for more info")
return
}
#expect(
caskFile.version ==
"5.7.2_1035"
)
#expect(
caskFile.sha256 ==
"1cb147bd1b1fbd52971d90dff577465b644aee7c878f15ede57f46e8f217067a"
)
#expect(
caskFile.name ==
"PHP Monitor DEV"
)
#expect(
caskFile.url ==
"https://github.com/nicoverbruggen/phpmon/releases/download/v5.7.2/phpmon-dev.zip"
)
}
@Test func can_extract_fields_from_remote_cask_file() async throws {
let url = URL(string: "https://raw.githubusercontent.com/nicoverbruggen/homebrew-cask/master/Casks/phpmon.rb")!
guard let caskFile = await CaskFile.from(url: url) else {
Issue.record("The remote CaskFile could not be parsed, check the log for more info")
return
}
#expect(caskFile.properties.keys.contains("version"))
#expect(caskFile.properties.keys.contains("homepage"))
#expect(caskFile.properties.keys.contains("url"))
}
}