import { describe, it, expect } from 'vitest' import { authUrl } from '../scripts/gmail-connect' describe('gmail connect', () => { it('builds the consent URL with offline access and gmail.send scope', () => { const u = new URL(authUrl('cid-1', 'http://localhost:5190/callback')) expect(u.origin + u.pathname).toBe('https://accounts.google.com/o/oauth2/v2/auth') expect(u.searchParams.get('client_id')).toBe('cid-1') expect(u.searchParams.get('access_type')).toBe('offline') expect(u.searchParams.get('prompt')).toBe('consent') expect(u.searchParams.get('scope')).toContain('gmail.send') }) })