oficina / docs Public

Clone
git clone https://amadan.net/oficina/docs

Plain git — no account needed to clone.

Download

Download this file

1import Foundation
2import XCTest
3@testable import DocsKit
4
5/// Every heading the style menu offers has a translation in every language
6/// Docs ships, under the exact key the menu looks up.
7final class EditorToolbarStringsTests: XCTestCase {
8 func testEveryHeadingKeyResolvesInEveryLanguage() throws {
9 let languages = DocsResources.bundle.localizations.filter { $0 != "Base" }
10 XCTAssertFalse(languages.isEmpty)
11 for language in languages {
12 let path = try XCTUnwrap(DocsResources.bundle.path(forResource: language, ofType: "lproj"), language)
13 let bundle = try XCTUnwrap(Bundle(path: path), language)
14 for level in 1...3 {
15 let key = EditorToolbar.headingKey(level)
16 let value = bundle.localizedString(forKey: key, value: nil, table: nil)
17 XCTAssertNotEqual(value, key, "\(language): \(key) has no translation")
18 XCTAssertFalse(value.contains("%"), "\(language): \(key) is a format, not a label")
19 }
20 }
21 }
22}
23