Skip to content

Commit 0b995e8

Browse files

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

static/gsApp/types/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,7 @@ export enum CreditType {
754754
REPLAY = 'replay',
755755
DISCOUNT = 'discount',
756756
PERCENT = 'percent',
757+
LOG_BYTE = 'log_byte',
757758
}
758759

759760
type BaseRecurringCredit = {
@@ -783,7 +784,8 @@ interface RecurringEventCredit extends BaseRecurringCredit {
783784
| CreditType.PROFILE_DURATION
784785
| CreditType.PROFILE_DURATION_UI
785786
| CreditType.ATTACHMENT
786-
| CreditType.REPLAY;
787+
| CreditType.REPLAY
788+
| CreditType.LOG_BYTE;
787789
}
788790

789791
export type RecurringCredit =

static/gsApp/views/subscriptionPage/recurringCredits.spec.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,33 @@ describe('Recurring Credits', function () {
206206
expect(screen.getByTestId('amount')).toHaveTextContent('+3M/mo');
207207
});
208208

209+
it('renders log byte recurring credits', async function () {
210+
MockApiClient.addMockResponse({
211+
url: `/customers/${organization.slug}/recurring-credits/`,
212+
method: 'GET',
213+
body: [
214+
RecurringCreditFixture({
215+
id: 1,
216+
periodStart: moment().format(),
217+
periodEnd: moment().utc().add(3, 'months').format(),
218+
amount: 2.5,
219+
type: CreditType.LOG_BYTE,
220+
totalAmountRemaining: null,
221+
}),
222+
],
223+
});
224+
225+
render(
226+
<RecurringCredits displayType="data" planDetails={subscription.planDetails} />,
227+
{organization}
228+
);
229+
230+
await screen.findByRole('heading', {name: /recurring credits/i});
231+
232+
expect(screen.getByText('logBytes')).toBeInTheDocument();
233+
expect(screen.getByTestId('amount')).toHaveTextContent('+2.5 GB/mo');
234+
});
235+
209236
it('renders multiple recurring credits', async function () {
210237
MockApiClient.addMockResponse({
211238
url: `/customers/${organization.slug}/recurring-credits/`,

0 commit comments

Comments
 (0)