Enforce user locks for AI updates
This commit is contained in:
@@ -137,6 +137,30 @@ final class ExistingLyricsRevisionDirectorTests: XCTestCase {
|
||||
let requestCount = await aiService.recordedRevisionRequests.count
|
||||
XCTAssertEqual(requestCount, 0)
|
||||
}
|
||||
|
||||
func testReviseExistingLyricsDoesNotCallAIWhenLyricsAreLocked() async throws {
|
||||
let aiService = RecordingLyricsAIService(
|
||||
revisionResult: LyricsRevisionResult(lyrics: Lyrics(text: "Unused"))
|
||||
)
|
||||
let director = ExistingLyricsRevisionDirector(aiService: aiService)
|
||||
let project = SongProject(
|
||||
title: "Locked Lyrics",
|
||||
idea: "Keep the words",
|
||||
lyrics: Lyrics(text: "User-approved lyrics"),
|
||||
userLocks: SongProjectUserLocks(scopes: [.lyrics])
|
||||
)
|
||||
|
||||
let result = try await director.reviseExistingLyrics(
|
||||
in: project,
|
||||
instruction: "Improve the chorus.",
|
||||
mode: .improve
|
||||
)
|
||||
let requestCount = await aiService.recordedRevisionRequests.count
|
||||
|
||||
XCTAssertEqual(requestCount, 0)
|
||||
XCTAssertEqual(result.project, project)
|
||||
XCTAssertTrue(result.changedScopes.isEmpty)
|
||||
}
|
||||
}
|
||||
|
||||
private actor RecordingLyricsAIService: AIService {
|
||||
|
||||
Reference in New Issue
Block a user