Files
zpan/shared/org-slugs.test.ts
T
saltbo 77aa770ed5 fix(workspaces): standardize workspace names and slugs
Use metadata-aware personal workspace detection across org repositories and UI, generate personal/team slugs with the new default random rules, and remove user-managed team slug fields.

Encode WebDAV path segments consistently so Finder follows workspace names such as Ambor's Space via %27 instead of XML-escaped apostrophes.
2026-07-09 01:00:03 -04:00

17 lines
872 B
TypeScript

import { describe, expect, it } from 'vitest'
import { generateTeamOrgSlug, generateUserOrgSlug, isPersonalOrgLike, isTeamOrgLike } from './org-slugs'
describe('org slug helpers', () => {
it('generates user and team slugs with the expected prefixes and length', () => {
expect(generateUserOrgSlug()).toMatch(/^u[a-z0-9]{16}$/)
expect(generateTeamOrgSlug()).toMatch(/^t[a-z0-9]{16}$/)
})
it('identifies personal orgs by metadata and legacy slug prefix', () => {
expect(isPersonalOrgLike({ slug: 'u1234567890abcdef', metadata: { type: 'personal' } })).toBe(true)
expect(isPersonalOrgLike({ slug: 'personal-user-1', metadata: null })).toBe(true)
expect(isPersonalOrgLike({ slug: 't1234567890abcdef', metadata: { type: 'team' } })).toBe(false)
expect(isTeamOrgLike({ slug: 't1234567890abcdef', metadata: { type: 'team' } })).toBe(true)
})
})