You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sims-hq/apps/hq/test/gmail-connect.test.ts

14 lines
622 B
TypeScript

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')
})
})