feat(commands): multi-select ordered command pipeline with step reordering and single-pass composition (AI-05, AI-07)
This commit is contained in:
parent
f49acf0105
commit
10af20a0ad
157 changed files with 29455 additions and 913 deletions
|
|
@ -1,4 +1,6 @@
|
|||
import { Feature } from '@d3ro/core/types'
|
||||
import { normalizeEntitlement } from '../src/lib/entitlement-context'
|
||||
import { resolveWebEntitlement } from '../../web/src/lib/entitlement'
|
||||
|
||||
describe('normalizeEntitlement', () => {
|
||||
const now = new Date('2026-08-21T00:00:00Z')
|
||||
|
|
@ -16,6 +18,7 @@ describe('normalizeEntitlement', () => {
|
|||
expect(snapshot.adFree).toBe(false)
|
||||
expect(snapshot.overageCredits).toBe(50)
|
||||
expect(snapshot.usageToday.stt_transcribe).toBe(3)
|
||||
expect(snapshot.features).not.toContain(Feature.TEAM_WORKSPACE)
|
||||
})
|
||||
|
||||
it('서버가 확인한 유효 paid period만 광고 제거 권한을 준다', () => {
|
||||
|
|
@ -34,7 +37,10 @@ describe('normalizeEntitlement', () => {
|
|||
current_period_end: '2026-08-20T00:00:00Z',
|
||||
}, [], [], now)
|
||||
|
||||
expect(active.tier).toBe('pro')
|
||||
expect(active.adFree).toBe(true)
|
||||
expect(active.features).toContain(Feature.TEAM_WORKSPACE)
|
||||
expect(expired.tier).toBe('free')
|
||||
expect(expired.adFree).toBe(false)
|
||||
})
|
||||
|
||||
|
|
@ -61,11 +67,41 @@ describe('normalizeEntitlement', () => {
|
|||
product_id: 'unknown',
|
||||
purchase_state: 'purchased',
|
||||
verified_at: 'invalid',
|
||||
}], now)
|
||||
}], now, 'manager')
|
||||
|
||||
expect(snapshot.tier).toBe('pro_plus')
|
||||
expect(snapshot.adFree).toBe(true)
|
||||
expect(snapshot.adminRole).toBe('manager')
|
||||
expect(snapshot.autoRenewing).toBe(false)
|
||||
expect(snapshot.purchases).toHaveLength(1)
|
||||
expect(snapshot.purchases[0].productId).toBe('d3ro_voice_pro_plus_monthly')
|
||||
})
|
||||
|
||||
it('웹 구독과 역할도 @d3ro/core resolveEntitlement 기준으로 정규화한다', () => {
|
||||
const activeWeb = resolveWebEntitlement({
|
||||
tier: 'pro_plus',
|
||||
status: 'active',
|
||||
provider: 'none',
|
||||
payment_provider: 'payple',
|
||||
current_period_end: '2026-09-21T00:00:00Z',
|
||||
overage_credits: 120,
|
||||
}, { supabaseRole: 'admin', now })
|
||||
|
||||
expect(activeWeb.tier).toBe('pro_plus')
|
||||
expect(activeWeb.provider).toBe('payple')
|
||||
expect(activeWeb.adFree).toBe(true)
|
||||
expect(activeWeb.adminRole).toBe('admin')
|
||||
expect(activeWeb.adminCapabilities.canAdmin).toBe(true)
|
||||
|
||||
const expiredWeb = resolveWebEntitlement({
|
||||
tier: 'pro',
|
||||
status: 'active',
|
||||
provider: 'payple',
|
||||
current_period_end: '2026-08-01T00:00:00Z',
|
||||
}, { now })
|
||||
|
||||
expect(expiredWeb.tier).toBe('free')
|
||||
expect(expiredWeb.rawTier).toBe('pro')
|
||||
expect(expiredWeb.adFree).toBe(false)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue