Files
oai-swift/oAITests/ThinkingVerbsTests.swift
T
rune c21fe49f4f Add per-language thinking verbs; close major i18n translation gap
- ThinkingVerbs now picks from a hand-written verb list per active
  display language (en/nb/sv/da/de/fr) instead of always English,
  fixed to be nonisolated at the type level (this project defaults
  to MainActor isolation, which was breaking the static verb arrays).
- SyncStatusIndicator.tooltipText was typed String instead of
  LocalizedStringKey, silently bypassing localization for .help() —
  fixed.
- Translated ~150 strings (750 individual translations) into
  nb/sv/da/de/fr that had never been localized: the entire slash-
  command dropdown, sync status labels, reasoning-effort
  descriptions, model sort options, and settings rows added across
  recent features (Git Sync conflict recovery, crash recovery,
  notes, backup, external MCP servers). Most were invisible to
  xcodebuild -exportLocalizations because they're LocalizedStringKey-
  typed properties/helpers rather than literal Text() calls, per the
  same gap documented from the original Phase 7 audit.
- AI-translated per the README's existing disclosure; verified live
  in nb and fr builds, and diffed the catalog to confirm zero
  pre-existing translations were altered, only additions.
2026-08-05 12:57:49 +02:00

61 lines
1.9 KiB
Swift

//
// ThinkingVerbsTests.swift
// oAITests
//
// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
// Copyright (C) 2026 Rune Olsen
import Testing
import Foundation
@testable import Confab
@Suite("ThinkingVerbs language selection")
struct ThinkingVerbsTests {
private let supportedCodes = ["en", "nb", "sv", "da", "de", "fr"]
@Test("Every supported language has its own non-empty verb list")
func perLanguageListsAreNonEmpty() {
for code in supportedCodes {
#expect(!ThinkingVerbs.verbs(for: code).isEmpty)
}
}
@Test("Unknown language codes fall back to English")
func unknownCodeFallsBackToEnglish() {
#expect(ThinkingVerbs.verbs(for: "xx") == ThinkingVerbs.verbs(for: "en"))
#expect(ThinkingVerbs.verbs(for: "") == ThinkingVerbs.verbs(for: "en"))
}
@Test("Each supported language's list is genuinely distinct, not a fallback copy of English")
func perLanguageListsAreDistinctFromEnglish() {
let english = ThinkingVerbs.verbs(for: "en")
for code in supportedCodes where code != "en" {
#expect(ThinkingVerbs.verbs(for: code) != english)
}
}
@Test("Language lists are comparable in size — none is a token stub")
func perLanguageListsAreComparablyMore() {
let minimumCount = 40
for code in supportedCodes {
#expect(ThinkingVerbs.verbs(for: code).count >= minimumCount)
}
}
@Test("No duplicate entries within a single language's list")
func noDuplicatesWithinLanguage() {
for code in supportedCodes {
let list = ThinkingVerbs.verbs(for: code)
#expect(Set(list).count == list.count)
}
}
@Test("random() returns a non-empty string ending in an ellipsis")
func randomProducesEllipsisSuffixedString() {
let result = ThinkingVerbs.random()
#expect(!result.isEmpty)
#expect(result.hasSuffix("..."))
}
}