1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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"))
}
}