Skip to content

Commit 5e9b314

Browse files
committed
Fix billing test to mock subscription endpoint
1 parent 3f81504 commit 5e9b314

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

packages/billing/src/__tests__/usage-service.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ describe('usage-service', () => {
4949
}),
5050
}))
5151

52+
await mockModule('@codebuff/billing/subscription', () => ({
53+
getActiveSubscription: async () => null,
54+
}))
55+
5256
const { getUserUsageData } = await import('@codebuff/billing/usage-service')
5357

5458
const result = await getUserUsageData({
@@ -81,6 +85,10 @@ describe('usage-service', () => {
8185
}),
8286
}))
8387

88+
await mockModule('@codebuff/billing/subscription', () => ({
89+
getActiveSubscription: async () => null,
90+
}))
91+
8492
const { getUserUsageData } = await import('@codebuff/billing/usage-service')
8593

8694
const result = await getUserUsageData({
@@ -110,6 +118,10 @@ describe('usage-service', () => {
110118
}),
111119
}))
112120

121+
await mockModule('@codebuff/billing/subscription', () => ({
122+
getActiveSubscription: async () => null,
123+
}))
124+
113125
const { getUserUsageData } = await import('@codebuff/billing/usage-service')
114126

115127
const result = await getUserUsageData({
@@ -140,6 +152,10 @@ describe('usage-service', () => {
140152
}),
141153
}))
142154

155+
await mockModule('@codebuff/billing/subscription', () => ({
156+
getActiveSubscription: async () => null,
157+
}))
158+
143159
const { getUserUsageData } = await import('@codebuff/billing/usage-service')
144160

145161
const result = await getUserUsageData({
@@ -171,6 +187,10 @@ describe('usage-service', () => {
171187
}),
172188
}))
173189

190+
await mockModule('@codebuff/billing/subscription', () => ({
191+
getActiveSubscription: async () => null,
192+
}))
193+
174194
const { getUserUsageData } = await import('@codebuff/billing/usage-service')
175195

176196
// Should not throw

0 commit comments

Comments
 (0)