2018-01-07 15:13:10 -08:00
|
|
|
//
|
|
|
|
|
// ScriptingTests.swift
|
2018-08-28 22:18:24 -07:00
|
|
|
// NetNewsWireTests
|
2018-01-07 15:13:10 -08:00
|
|
|
//
|
|
|
|
|
// Created by Olof Hellman on 1/7/18.
|
|
|
|
|
// Copyright © 2018 Olof Hellman. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import XCTest
|
|
|
|
|
|
2025-11-18 19:58:48 -08:00
|
|
|
@MainActor final class ScriptingTests: AppleScriptXCTestCase {
|
2018-01-07 15:13:10 -08:00
|
|
|
/*
|
|
|
|
|
@function testGenericScript
|
|
|
|
|
@brief An example of how a script can be run as part of an XCTest
|
|
|
|
|
the applescript returns
|
|
|
|
|
{test_result:true, script_result:"Geoducks!"}
|
|
|
|
|
doIndividualScript() verifies the test_result portion
|
|
|
|
|
this code verifies the script_result portion
|
|
|
|
|
*/
|
|
|
|
|
func testGenericScript() {
|
|
|
|
|
let scriptResult = doIndividualScript(filename: "testGenericScript")
|
2025-12-31 11:38:56 -08:00
|
|
|
XCTAssert(scriptResult?.stringValue == "Geoducks!")
|
2018-01-07 15:13:10 -08:00
|
|
|
}
|
2025-11-05 11:22:10 -08:00
|
|
|
|
2018-01-07 15:13:10 -08:00
|
|
|
func testGetUrlScript() {
|
|
|
|
|
_ = doIndividualScript(filename: "testGetURL")
|
|
|
|
|
}
|
2025-11-05 11:22:10 -08:00
|
|
|
|
2018-01-11 00:51:25 -08:00
|
|
|
func testNameAndUrlOfEveryFeedScript() {
|
|
|
|
|
_ = doIndividualScript(filename: "testNameAndUrlOfEveryFeed")
|
|
|
|
|
}
|
2025-11-05 11:22:10 -08:00
|
|
|
|
2018-01-11 00:51:25 -08:00
|
|
|
func testNameOfEveryFolderScript() {
|
|
|
|
|
_ = doIndividualScript(filename: "testNameOfEveryFolder")
|
|
|
|
|
}
|
2025-11-05 11:22:10 -08:00
|
|
|
|
2018-01-19 22:31:17 -08:00
|
|
|
func testNameOfAuthorsScript() {
|
|
|
|
|
_ = doIndividualScript(filename: "testNameOfAuthors")
|
|
|
|
|
}
|
2025-11-05 11:22:10 -08:00
|
|
|
|
2018-04-25 21:40:50 -07:00
|
|
|
func testFeedExists() {
|
|
|
|
|
_ = doIndividualScript(filename: "testFeedExists")
|
|
|
|
|
}
|
2025-11-05 11:22:10 -08:00
|
|
|
|
2026-01-01 15:50:20 -08:00
|
|
|
func doIndividualScriptWithExpectation(filename: String) {
|
2018-02-11 01:20:30 -08:00
|
|
|
let scriptExpectation = self.expectation(description: filename+"expectation")
|
2025-10-06 10:24:50 -07:00
|
|
|
DispatchQueue.main.async {
|
2025-12-31 11:38:56 -08:00
|
|
|
_ = self.doIndividualScript(filename: filename)
|
2018-02-11 01:20:30 -08:00
|
|
|
scriptExpectation.fulfill()
|
|
|
|
|
}
|
2025-12-31 11:38:56 -08:00
|
|
|
self.wait(for: [scriptExpectation], timeout: 60)
|
2018-02-11 01:20:30 -08:00
|
|
|
}
|
2018-01-07 15:13:10 -08:00
|
|
|
}
|