Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd18bd7d

Browse files
committed
Add comprehensive UI tests for arguments and deeplink URLs
Introduces new test suites for argument generation and deeplink URL creation in RsyncUITests.swift. Tests cover dry-run arguments, syncremote tasks, push local-to-remote with keepdelete variations, and deeplink URL creation for default and custom profiles. SwiftLint is disabled for the file to accommodate the expanded test code.
1 parentcd3a770 commitd18bd7d

File tree

1 file changed

+104
-1
lines changed

1 file changed

+104
-1
lines changed

‎RsyncUITests/RsyncUITests.swift‎

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,113 @@
44
//
55
// Created by Thomas Evensen on 18/12/2025.
66
//
7-
7+
// swiftlint:disable all
8+
// xcodebuild -scheme RsyncUI -project RsyncUI.xcodeproj -destination 'platform=macOS' -only-testing:RsyncUITests test
89
import Testing
10+
import Foundation
11+
import RsyncArguments
912
@testableimport RsyncUI
1013

1114
structRsyncUITests{
1215

16+
@MainActor
17+
@Suite("Arguments Generation Tests",.serialized)
18+
structArgumentsSynchronizeTests{
19+
func makeConfig(
20+
task:String="synchronize",
21+
local:String="/Users/test/Documents/",
22+
remote:String="/backup/Documents/",
23+
username:String="",
24+
server:String=""
25+
)->SynchronizeConfiguration{
26+
varcfg=SynchronizeConfiguration()
27+
cfg.task= task
28+
cfg.localCatalog= local
29+
cfg.offsiteCatalog= remote
30+
cfg.offsiteUsername= username
31+
cfg.offsiteServer= server
32+
cfg.halted=0
33+
return cfg
34+
}
35+
36+
@Test("Synchronize returns dry-run args")
37+
func synchronizeDryRunArgs()async{
38+
SharedReference.shared.rsyncversion3=true
39+
40+
letcfg=makeConfig()
41+
letgenerator=ArgumentsSynchronize(config: cfg)
42+
letargs= generator.argumentsSynchronize(dryRun:true, forDisplay:false)
43+
44+
#expect(args!=nil)
45+
// Accept either common dry-run flags
46+
#expect(args!.contains("--dry-run") || args!.contains("-n"))
47+
}
48+
/*
49+
@Test("Snapshot task produces arguments")
50+
func snapshotArgs() async {
51+
SharedReference.shared.rsyncversion3 = true
52+
53+
var cfg = makeConfig(task: SharedReference.shared.snapshot,
54+
username: "testuser",
55+
server: "localhost")
56+
let generator = ArgumentsSynchronize(config: cfg)
57+
let args = generator.argumentsSynchronize(dryRun: false, forDisplay: false)
58+
59+
#expect(args != nil)
60+
}
61+
*/
62+
@Test("Syncremote task produces arguments")
63+
func syncremoteArgs()async{
64+
SharedReference.shared.rsyncversion3=true
65+
66+
letcfg=makeConfig(task:SharedReference.shared.syncremote,
67+
username:"testuser",
68+
server:"testserver.local")
69+
letgenerator=ArgumentsSynchronize(config: cfg)
70+
letargs= generator.argumentsSynchronize(dryRun:true, forDisplay:false)
71+
72+
#expect(args!=nil)
73+
}
74+
75+
@Test("Push local→remote with keepdelete variations")
76+
func pushLocalToRemoteArgs()async{
77+
SharedReference.shared.rsyncversion3=true
78+
79+
letcfg=makeConfig()
80+
letgenerator=ArgumentsSynchronize(config: cfg)
81+
82+
letargsKeep= generator.argumentsforpushlocaltoremotewithparameters(dryRun:false,
83+
forDisplay:false,
84+
keepdelete:true)
85+
letargsNoKeep= generator.argumentsforpushlocaltoremotewithparameters(dryRun:false,
86+
forDisplay:false,
87+
keepdelete:false)
88+
89+
#expect(argsKeep!=nil)
90+
#expect(argsNoKeep!=nil)
91+
}
92+
}
93+
94+
@MainActor
95+
@Suite("Deeplink URL Tests",.serialized)
96+
structDeeplinkURLTests{
97+
@Test("Create estimate-and-synchronize URL with default profile")
98+
func createURLDefaultProfile()async{
99+
leturl=DeeplinkURL().createURLestimateandsynchronize(valueprofile:nil)
100+
#expect(url!=nil)
101+
#expect(url!.absoluteString.contains("profile=Default"))
102+
}
103+
104+
@Test("Create estimate-and-synchronize URL with custom profile")
105+
func createURLCustomProfile()async{
106+
leturl=DeeplinkURL().createURLestimateandsynchronize(valueprofile:"Work")
107+
#expect(url!=nil)
108+
#expect(url!.absoluteString.contains("profile=Work"))
109+
}
110+
}
111+
112+
113+
13114
@MainActor
14115
@Suite("Configuration Validation Tests",.serialized)
15116
structVerifyConfigurationTests{
@@ -545,3 +646,5 @@ struct RsyncUITests {
545646

546647

547648
}
649+
// swiftlint:enable all
650+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp