From 91d64308152e53e9d320f9168cff68ddfd529c05 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 8 May 2023 16:58:50 -0400 Subject: [PATCH] Fix various tests --- .../CharacterCounterTests.swift | 31 ++++++++++--------- .../xcshareddata/xcschemes/Pachyderm.xcscheme | 8 ++--- .../NotificationGroupTests.swift | 1 + 3 files changed, 22 insertions(+), 18 deletions(-) rename Packages/{Pachyderm/Tests/PachydermTests => ComposeUI/Tests/ComposeUITests}/CharacterCounterTests.swift (63%) rename {Tusker.xcodeproj => Packages/Pachyderm/.swiftpm/xcode}/xcshareddata/xcschemes/Pachyderm.xcscheme (91%) diff --git a/Packages/Pachyderm/Tests/PachydermTests/CharacterCounterTests.swift b/Packages/ComposeUI/Tests/ComposeUITests/CharacterCounterTests.swift similarity index 63% rename from Packages/Pachyderm/Tests/PachydermTests/CharacterCounterTests.swift rename to Packages/ComposeUI/Tests/ComposeUITests/CharacterCounterTests.swift index 887efe0d..c688ac32 100644 --- a/Packages/Pachyderm/Tests/PachydermTests/CharacterCounterTests.swift +++ b/Packages/ComposeUI/Tests/ComposeUITests/CharacterCounterTests.swift @@ -1,13 +1,14 @@ // // CharacterCounterTests.swift -// PachydermTests +// ComposeUITests // // Created by Shadowfacts on 9/29/18. // Copyright © 2018 Shadowfacts. All rights reserved. // import XCTest -@testable import Pachyderm +@testable import ComposeUI +import InstanceFeatures class CharacterCounterTests: XCTestCase { @@ -16,32 +17,34 @@ class CharacterCounterTests: XCTestCase { override func tearDown() { } + + let features = InstanceFeatures() func testCountEmpty() { - XCTAssertEqual(CharacterCounter.count(text: ""), 0) + XCTAssertEqual(CharacterCounter.count(text: "", for: features), 0) } func testCountPlainText() { - XCTAssertEqual(CharacterCounter.count(text: "This is an example message"), 26) - XCTAssertEqual(CharacterCounter.count(text: "This is an example message with an Emoji: 😄"), 43) - XCTAssertEqual(CharacterCounter.count(text: "😄😄😄😄😄😄😄"), 7) + XCTAssertEqual(CharacterCounter.count(text: "This is an example message", for: features), 26) + XCTAssertEqual(CharacterCounter.count(text: "This is an example message with an Emoji: 😄", for: features), 43) + XCTAssertEqual(CharacterCounter.count(text: "😄😄😄😄😄😄😄", for: features), 7) } func testCountLinks() { - XCTAssertEqual(CharacterCounter.count(text: "This is an example with a link: https://example.com"), 55) - XCTAssertEqual(CharacterCounter.count(text: "This is an example with a link 😄: https://example.com"), 57) - XCTAssertEqual(CharacterCounter.count(text: "😄😄😄😄😄😄😄: https://example.com"), 32) - XCTAssertEqual(CharacterCounter.count(text: "This is an example with a link: https://a.much.longer.example.com/link?foo=bar#baz"), 55) + XCTAssertEqual(CharacterCounter.count(text: "This is an example with a link: https://example.com", for: features), 55) + XCTAssertEqual(CharacterCounter.count(text: "This is an example with a link 😄: https://example.com", for: features), 57) + XCTAssertEqual(CharacterCounter.count(text: "😄😄😄😄😄😄😄: https://example.com", for: features), 32) + XCTAssertEqual(CharacterCounter.count(text: "This is an example with a link: https://a.much.longer.example.com/link?foo=bar#baz", for: features), 55) } func testCountLocalMentions() { - XCTAssertEqual(CharacterCounter.count(text: "hello @example"), 14) - XCTAssertEqual(CharacterCounter.count(text: "@some_really_long_name"), 22) + XCTAssertEqual(CharacterCounter.count(text: "hello @example", for: features), 14) + XCTAssertEqual(CharacterCounter.count(text: "@some_really_long_name", for: features), 22) } func testCountRemoteMentions() { - XCTAssertEqual(CharacterCounter.count(text: "hello @example@some.remote.social"), 14) - XCTAssertEqual(CharacterCounter.count(text: "hello @some_really_long_name@some-long.remote-instance.social"), 28) + XCTAssertEqual(CharacterCounter.count(text: "hello @example@some.remote.social", for: features), 14) + XCTAssertEqual(CharacterCounter.count(text: "hello @some_really_long_name@some-long.remote-instance.social", for: features), 28) } } diff --git a/Tusker.xcodeproj/xcshareddata/xcschemes/Pachyderm.xcscheme b/Packages/Pachyderm/.swiftpm/xcode/xcshareddata/xcschemes/Pachyderm.xcscheme similarity index 91% rename from Tusker.xcodeproj/xcshareddata/xcschemes/Pachyderm.xcscheme rename to Packages/Pachyderm/.swiftpm/xcode/xcshareddata/xcschemes/Pachyderm.xcscheme index e5d2701f..019ba136 100644 --- a/Tusker.xcodeproj/xcshareddata/xcschemes/Pachyderm.xcscheme +++ b/Packages/Pachyderm/.swiftpm/xcode/xcshareddata/xcschemes/Pachyderm.xcscheme @@ -17,7 +17,7 @@ BlueprintIdentifier = "D61099AA2144B0CC00432DC2" BuildableName = "Pachyderm.framework" BlueprintName = "Pachyderm" - ReferencedContainer = "container:Tusker.xcodeproj"> + ReferencedContainer = "container:../../Tusker.xcodeproj"> @@ -35,7 +35,7 @@ BlueprintIdentifier = "PachydermTests" BuildableName = "PachydermTests" BlueprintName = "PachydermTests" - ReferencedContainer = "container:Pachyderm"> + ReferencedContainer = "container:"> @@ -56,7 +56,7 @@ BlueprintIdentifier = "D61099AA2144B0CC00432DC2" BuildableName = "Pachyderm.framework" BlueprintName = "Pachyderm" - ReferencedContainer = "container:Tusker.xcodeproj"> + ReferencedContainer = "container:../../Tusker.xcodeproj"> @@ -72,7 +72,7 @@ BlueprintIdentifier = "D61099AA2144B0CC00432DC2" BuildableName = "Pachyderm.framework" BlueprintName = "Pachyderm" - ReferencedContainer = "container:Tusker.xcodeproj"> + ReferencedContainer = "container:../../Tusker.xcodeproj"> diff --git a/Packages/Pachyderm/Tests/PachydermTests/NotificationGroupTests.swift b/Packages/Pachyderm/Tests/PachydermTests/NotificationGroupTests.swift index fc361e01..aa079875 100644 --- a/Packages/Pachyderm/Tests/PachydermTests/NotificationGroupTests.swift +++ b/Packages/Pachyderm/Tests/PachydermTests/NotificationGroupTests.swift @@ -8,6 +8,7 @@ import XCTest @testable import Pachyderm +@MainActor class NotificationGroupTests: XCTestCase { let decoder: JSONDecoder = {