using Xunit; namespace ytLive.Tests; /// Adding the Analytics scope means existing sessions lack it. The app must be able to TELL /// — an anonymous 403 mid-stream is the failure this guards against. public class AnalyticsScopeTests { [Fact] public void The_app_asks_for_analytics_and_can_tell_when_a_session_lacks_it() { var source = SourceAssert.Text("Services", "YouTubeAuthService.cs"); // Requested, incrementally (so an existing user sees only the new prompt). Assert.Contains("yt-analytics.readonly", source); Assert.Contains("include_granted_scopes", source); // And the grant is inspected from the token response, not assumed. Assert.Contains("CaptureScopes", source); Assert.Contains("HasAnalyticsScope", source); // A connection type that exposes the flag, so the scoreboard can offer the one-click path. Assert.NotNull(typeof(ytLive.Services.YouTubeAuthService).GetProperty("HasAnalyticsScope")); } }