Files
zeekay e0b7898e56 Signing out of hanzo.bot stays signed out, and hanzo.team passes through
hanzo.bot and cloud.hanzo.ai leave their /login for hanzo.ai, and hanzo.ai
answers them from its session on arrival, so the /login?from=logout a
sign-out lands on signed the person straight back in. That page draws the
panel and leaves only on Continue.

hanzo.team, Hanzo's workspace, now signs in here with its own request; it
is answered on arrival like the other Hanzo sites, instead of with the sheet.
2026-10-17 09:15:18 -07:00

28 lines
1.4 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { test, expect } from '@playwright/test'
import { asker, ours } from '../../lib/auth/asker'
// "Continue as" names who asked: a site by its host, a native app as one.
test('a site on the web is named by its host', () => {
expect(asker('https://platform.hanzo.ai/auth/callback')).toBe('platform.hanzo.ai')
expect(asker('https://studio.hanzo.ai/callback')).toBe('studio.hanzo.ai')
})
test('a native app, a loopback port or nothing names no site', () => {
expect(asker('hanzo://oauth/hanzo')).toBeNull()
expect(asker('http://127.0.0.1:8765/callback')).toBeNull()
expect(asker('https://localhost:3000/auth/callback')).toBeNull()
expect(asker(undefined)).toBeNull()
expect(asker('not a url')).toBeNull()
})
// A Hanzo site on the web is answered on arrival; anything else gets the sheet.
test('Hanzo’s own web sites are ours', () => {
for (const cb of ['https://platform.hanzo.ai/auth/callback', 'https://studio.hanzo.ai/callback', 'https://admin.hanzo.ai/auth/callback', 'https://hanzo.bot/auth/callback', 'https://hanzo.team/auth/callback'])
expect(ours(cb), cb).toBe(true)
})
test('a native app, a lookalike or another site is not', () => {
for (const cb of ['hanzo://oauth/hanzo', 'http://platform.hanzo.ai/auth/callback', 'https://hanzo.ai.evil.com/cb', 'https://evilhanzo.ai/cb', 'https://example.com/cb', undefined])
expect(ours(cb), String(cb)).toBe(false)
})