Skip to content

Commit a150290

Browse files
committed
fix: filter disabled plugins from availableDatabaseTypes, add pluginTypeId alias tests
1 parent 2332b31 commit a150290

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

TablePro/Core/Plugins/PluginManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ final class PluginManager {
324324
/// All database types with loaded plugins, ordered by display name.
325325
var availableDatabaseTypes: [DatabaseType] {
326326
var types: [DatabaseType] = []
327-
for entry in plugins {
327+
for entry in plugins where entry.isEnabled {
328328
if let typeId = entry.databaseTypeId {
329329
types.append(DatabaseType(rawValue: typeId))
330330
}

TableProTests/Models/DatabaseTypeTests.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,23 @@ struct DatabaseTypeTests {
9191
#expect(DatabaseType.clickhouse.iconName == "clickhouse-icon")
9292
}
9393

94+
// MARK: - Plugin Type ID Alias Tests
95+
96+
@Test("MariaDB pluginTypeId maps to MySQL plugin")
97+
func testMariaDBPluginTypeId() {
98+
#expect(DatabaseType.mariadb.pluginTypeId == "MySQL")
99+
}
100+
101+
@Test("Redshift pluginTypeId maps to PostgreSQL plugin")
102+
func testRedshiftPluginTypeId() {
103+
#expect(DatabaseType.redshift.pluginTypeId == "PostgreSQL")
104+
}
105+
106+
@Test("Unknown type pluginTypeId falls back to rawValue")
107+
func testUnknownPluginTypeIdFallback() {
108+
#expect(DatabaseType(rawValue: "FutureDB").pluginTypeId == "FutureDB")
109+
}
110+
94111
// MARK: - Struct Behavior Tests
95112

96113
@Test("Struct equality via rawValue")

0 commit comments

Comments
 (0)