Skip to content

Commit 668177e

Browse files
authored
Merge pull request #134 from github/asizikov/included-credit-policy
Add included credit policy types
2 parents 2de810c + 6ba9623 commit 668177e

3 files changed

Lines changed: 312 additions & 55 deletions

File tree

src/pipeline/aicIncludedCredits.test.ts

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ import {
2020
PRO_PLUS_MONTHLY_QUOTA,
2121
selectKnownMonthlyQuota,
2222
} from './aicIncludedCredits'
23+
import {
24+
NATIVE_AI_CREDITS_STANDARD_INCLUDED_CREDITS_POLICY,
25+
NATIVE_AI_CREDITS_SUMMER_PROMO_INCLUDED_CREDITS_POLICY,
26+
TRANSITION_PERIOD_INCLUDED_CREDITS_POLICY,
27+
} from './includedCreditsPolicy'
2328
import { CostCenterAggregator } from './aggregators/costCenterAggregator'
2429
import { OrganizationAggregator } from './aggregators/organizationAggregator'
2530
import { UserUsageAggregator } from './aggregators/userUsageAggregator'
@@ -127,6 +132,68 @@ describe('AIC included credit tiering and pool sizing', () => {
127132
expect(getAicIncludedCreditTier(ENTERPRISE_MONTHLY_QUOTA, 'individual')).toBeNull()
128133
})
129134

135+
it('separates transition-period quota identity from included AI Credits entitlement', () => {
136+
expect(TRANSITION_PERIOD_INCLUDED_CREDITS_POLICY.organizationPlans.business.identity).toEqual({
137+
tier: 'business',
138+
quotaUnit: 'pru',
139+
monthlyQuota: BUSINESS_MONTHLY_QUOTA,
140+
})
141+
expect(TRANSITION_PERIOD_INCLUDED_CREDITS_POLICY.organizationPlans.business.monthlyIncludedCredits).toBe(
142+
BUSINESS_MONTHLY_AIC_INCLUDED_CREDITS,
143+
)
144+
expect(TRANSITION_PERIOD_INCLUDED_CREDITS_POLICY.organizationPlans.enterprise.identity).toEqual({
145+
tier: 'enterprise',
146+
quotaUnit: 'pru',
147+
monthlyQuota: ENTERPRISE_MONTHLY_QUOTA,
148+
})
149+
expect(TRANSITION_PERIOD_INCLUDED_CREDITS_POLICY.organizationPlans.enterprise.monthlyIncludedCredits).toBe(
150+
ENTERPRISE_MONTHLY_AIC_INCLUDED_CREDITS,
151+
)
152+
})
153+
154+
it('keeps native AI Credits policies available without changing default transition-period tiering', () => {
155+
expect(NATIVE_AI_CREDITS_SUMMER_PROMO_INCLUDED_CREDITS_POLICY.organizationPlans.business.identity).toEqual({
156+
tier: 'business',
157+
quotaUnit: 'aic',
158+
monthlyQuota: 1900,
159+
})
160+
expect(NATIVE_AI_CREDITS_SUMMER_PROMO_INCLUDED_CREDITS_POLICY.organizationPlans.business.monthlyIncludedCredits).toBe(
161+
3000,
162+
)
163+
expect(NATIVE_AI_CREDITS_SUMMER_PROMO_INCLUDED_CREDITS_POLICY.organizationPlans.enterprise.identity).toEqual({
164+
tier: 'enterprise',
165+
quotaUnit: 'aic',
166+
monthlyQuota: 3900,
167+
})
168+
expect(NATIVE_AI_CREDITS_SUMMER_PROMO_INCLUDED_CREDITS_POLICY.organizationPlans.enterprise.monthlyIncludedCredits).toBe(
169+
7000,
170+
)
171+
expect(NATIVE_AI_CREDITS_STANDARD_INCLUDED_CREDITS_POLICY.organizationPlans.business.monthlyIncludedCredits).toBe(
172+
1900,
173+
)
174+
expect(NATIVE_AI_CREDITS_STANDARD_INCLUDED_CREDITS_POLICY.organizationPlans.enterprise.monthlyIncludedCredits).toBe(
175+
3900,
176+
)
177+
expect(getAicIncludedCreditTier(1900)).toBeNull()
178+
expect(getMonthlyAicIncludedCredits(3900)).toBe(0)
179+
expect(getAicIncludedCreditTier(
180+
1900,
181+
'organization',
182+
NATIVE_AI_CREDITS_SUMMER_PROMO_INCLUDED_CREDITS_POLICY,
183+
)).toBe('business')
184+
expect(getMonthlyAicIncludedCredits(
185+
3900,
186+
'organization',
187+
NATIVE_AI_CREDITS_STANDARD_INCLUDED_CREDITS_POLICY,
188+
)).toBe(3900)
189+
expect(getPlanLabel(1900, 'organization', NATIVE_AI_CREDITS_SUMMER_PROMO_INCLUDED_CREDITS_POLICY)).toBe(
190+
'Copilot Business',
191+
)
192+
expect(getPlanLabel(1234, 'organization', NATIVE_AI_CREDITS_SUMMER_PROMO_INCLUDED_CREDITS_POLICY)).toBe(
193+
'Unknown (1,234 AI Credits/month)',
194+
)
195+
})
196+
130197
it('classifies 300 as Pro/Student for an individual report', () => {
131198
expect(getIndividualPlanTier(PRO_MONTHLY_QUOTA)).toBe('pro-student')
132199
})

0 commit comments

Comments
 (0)