Skip to content

Commit e0b9837

Browse files
authored
Merge pull request #50 from TaloDev/develop
Release 0.13.1
2 parents fcdfb79 + e2c7156 commit e0b9837

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@
6767
"lint-staged": {
6868
"*.{js,jsx}": "eslint --fix"
6969
},
70-
"version": "0.13.0"
70+
"version": "0.13.1"
7171
}

src/pages/Billing.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ export default function Billing() {
7474
}
7575

7676
<BillingUsageTile />
77-
<BillingPortalTile />
77+
78+
{orgPlan.canViewBillingPortal &&
79+
<BillingPortalTile />
80+
}
7881
</ul>
7982
</div>
8083

src/pages/__tests__/Billing.test.jsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ describe('<Billing />', () => {
3535
]
3636
},
3737
status: 'active',
38-
endDate: null
38+
endDate: null,
39+
canViewBillingPortal: true
3940
}
4041

4142
const userValue = {
@@ -181,6 +182,26 @@ describe('<Billing />', () => {
181182
expect(await screen.findByText('Your plan expires on 2nd Mar 2022')).toBeInTheDocument()
182183
})
183184

185+
it('should not render the billing portal tile if they cannot view it', async () => {
186+
const pricingPlan = {
187+
...orgPlan,
188+
canViewBillingPortal: false
189+
}
190+
191+
axiosMock.onGet('http://talo.test/billing/organisation-plan').replyOnce(200, { pricingPlan })
192+
axiosMock.onGet('http://talo.test/billing/plans').replyOnce(200, { pricingPlans })
193+
axiosMock.onGet('http://talo.test/billing/usage').replyOnce(200, { usage })
194+
195+
render(
196+
<KitchenSink states={[{ node: userState, initialValue: userValue }]}>
197+
<Billing />
198+
</KitchenSink>
199+
)
200+
201+
expect(await screen.findByText('Current plan')).toBeInTheDocument()
202+
expect(screen.queryByText('Billing details')).not.toBeInTheDocument()
203+
})
204+
184205
it('should handle organisation plan errors', async () => {
185206
axiosMock.onGet('http://talo.test/billing/organisation-plan').networkErrorOnce()
186207
axiosMock.onGet('http://talo.test/billing/plans').replyOnce(200, { pricingPlans })

0 commit comments

Comments
 (0)