Repository Public MIT
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project : SP GlassKit7// File : Tests/SPGlassCoreTests/GlassComponentCatalogTests.swift8// Module : SPGlassCoreTests9// Repository : https://git.spboucher.ai/sp-glasskit10// Project Website : https://glass.spboucher.ai11// Created : 2026-12-0212// Last Modified : 2026-12-0213//14// Author : Simon-Pierre Boucher15// Position : Professor of Finance16// Institution : Université du Québec en Outaouais (UQO)17// Organization : SP Boucher18// Website : https://spboucher.ai19// Git : https://git.spboucher.ai20//21// Preferred Contact: contact@spboucher.ai22// Development : dev@spboucher.ai23// Support : support@spboucher.ai24// Security/Admin : admin@spboucher.ai25//26// Copyright (c) 202627// Simon-Pierre Boucher28// All rights reserved where applicable. This file is governed by the29// applicable project license, copyright notices and relevant law.30// Existing third-party rights and notices remain unaffected.31//32// License : MIT33//34// Do not embed credentials, private keys, access tokens,35// certificates or confidential personal information.36//37// =============================================================================38// END OF SP BOUCHER SOURCE HEADER39// =============================================================================4041import Foundation42import Testing43@testable import SPGlassCore4445@Suite("Component catalogue")46struct GlassComponentCatalogTests {47 @Test func holdsFiftyUniqueComponentsInOrder() {48 let all = GlassComponentCatalog.all49 #expect(all.count == 50)50 #expect(Set(all.map(\.id)).count == 50 && Set(all.map(\.name)).count == 50)51 #expect(all.map(\.number) == Array(1...50))52 }5354 @Test("Each category holds five components", arguments: GlassComponentCategory.allCases)55 func fivePerCategory(category: GlassComponentCategory) {56 #expect(GlassComponentCatalog.components(in: category).count == 5)57 }5859 @Test func identifiersAreKebabCase() {60 #expect(GlassComponentCatalog.identifier(for: "GlassTabBar") == "glass-tab-bar")61 #expect(GlassComponentCatalog.identifier(for: "GlassOTPField") == "glass-otp-field")62 #expect(GlassComponentCatalog.identifier(for: "GlassAgentPanel") == "glass-agent-panel")63 for entry in GlassComponentCatalog.all {64 #expect(entry.id.wholeMatch(of: /glass(-[a-z]+)+/) != nil, "\(entry.id)")65 #expect(entry.name.hasPrefix("Glass") && !entry.summary.isEmpty)66 }67 }6869 @Test func everyKindIsOneOfTheThreePublicKinds() {70 for entry in GlassComponentCatalog.all {71 #expect(entry.kind != .primitive)72 }73 #expect(GlassComponentCatalog.component(id: "glass-button")?.kind == .nativeWrapper)74 #expect(GlassComponentCatalog.component(id: "nope") == nil)75 }76}77