~ knotless Search/
↑↓ move↵ open⇧↵ all results

johnandersen777.bsky.social/atirc-ios-client

0
1
main
20 lines · 1.0 KB Raw History
import Testing
@testable import AT_IRC

/// Guards the scope literal: exactly the embedded requester's
/// oauth.RequesterOAuthScope (13 tokens at socialweb-computer-kcp 5e6c4e3d).
@MainActor
struct OAuthScopeTests {
    @Test func requesterScopeIsTheEmbeddedRequesterScope() {
        let scopes = OAuthClient.scope.split(separator: " ").map(String.init)
        #expect(scopes.count == 13)
        #expect(Set(scopes).count == scopes.count, "scope tokens must be unique")
        #expect(scopes.first == "atproto")
        #expect(scopes.filter { $0.hasPrefix("repo:") }.count == 3)
        #expect(scopes.filter { $0.hasPrefix("rpc:") }.count == 6)
        #expect(scopes.contains("rpc:chat.atirc.mint?aud=did:web:irc.fedfork.com%23atirc"))
        #expect(scopes.contains("rpc:chat.atirc.revoke?aud=did:web:irc.fedfork.com%23atirc"))
        #expect(scopes.contains("repo:computer.socialweb.ingress.offer?action=create&action=delete"))
        #expect(scopes.contains("repo:computer.socialweb.peer?action=create&action=update&action=delete"))
    }
}