Skip to content
Repos

WO_DevPlaceIOS

Swift 953 B40 lines Opens in site

Directory Raw Download

import Testing
@testable import DevPlaceSwiftSDK

struct NotificationTypeTests {
    private static let backendTypes = [
        "comment",
        "reply",
        "thread",
        "mention",
        "vote",
        "follow",
        "message",
        "badge",
        "level",
        "issue",
        "reminder",
        "harvest_stolen",
        "award",
        "quiz_attempt",
        "battle",
        "workspace",
        "moderation",
        "system",
        "ai_quota_warning",
        "game_upkeep",
    ]

    @Test(arguments: backendTypes)
    func decodesBackendType(rawValue: String) {
        #expect(NotificationType(rawValue: rawValue)?.rawValue == rawValue)
    }

    @Test func coversExactlyTheBackendTypes() {
        #expect(Set(NotificationType.allCases.map(\.rawValue)) == Set(Self.backendTypes))
    }

    @Test func unknownTypeDecodesToNil() {
        #expect(NotificationType(rawValue: "brand_new_type") == nil)
    }
}
25.6ms