//
//  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("..."))
    }
}
