Skip to content

Commit

Permalink
Make FindKeyCommand async and re-enable its test
Browse files Browse the repository at this point in the history
  • Loading branch information
fwcd committed Jul 2, 2024
1 parent 887e8e3 commit 469baa0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Sources/D2Commands/Music/FindKeyCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public class FindKeyCommand: StringCommand {

public init() {}

public func invoke(with input: String, output: any CommandOutput, context: CommandContext) {
public func invoke(with input: String, output: any CommandOutput, context: CommandContext) async {
guard !input.isEmpty,
let notes = try? input.split(separator: " ").map({ try Note(parsing: String($0)) }) else {
output.append(errorText: info.helpText!)
await output.append(errorText: info.helpText!)
return
}

Expand All @@ -26,6 +26,6 @@ public class FindKeyCommand: StringCommand {
MinorScale(key: Note(noteClass: key, octave: 0)),
] }
.filter { noteClasses.isSubset(of: $0.notes.map(\.noteClass)) }
output.append("Possible keys: \(scales.map(\.abbreviatedClassName).joined(separator: " "))")
await output.append("Possible keys: \(scales.map(\.abbreviatedClassName).joined(separator: " "))")
}
}
2 changes: 0 additions & 2 deletions Tests/D2CommandTests/Music/FindKeyCommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import D2TestUtils

final class FindKeyCommandTests: XCTestCase {
func testFindKey() async throws {
return // FIXME: Re-enable this test once Sink etc. are async, otherwise the awaits might not actually await

let command = FindKeyCommand()
let output = TestOutput()

Expand Down

0 comments on commit 469baa0

Please sign in to comment.