import Foundation import XCTest @testable import DocsKit /// Every heading the style menu offers has a translation in every language /// Docs ships, under the exact key the menu looks up. final class EditorToolbarStringsTests: XCTestCase { func testEveryHeadingKeyResolvesInEveryLanguage() throws { let languages = DocsResources.bundle.localizations.filter { $0 != "Base" } XCTAssertFalse(languages.isEmpty) for language in languages { let path = try XCTUnwrap(DocsResources.bundle.path(forResource: language, ofType: "lproj"), language) let bundle = try XCTUnwrap(Bundle(path: path), language) for level in 1...3 { let key = EditorToolbar.headingKey(level) let value = bundle.localizedString(forKey: key, value: nil, table: nil) XCTAssertNotEqual(value, key, "\(language): \(key) has no translation") XCTAssertFalse(value.contains("%"), "\(language): \(key) is a format, not a label") } } } }