File tree Expand file tree Collapse file tree 3 files changed +27
-3
lines changed
Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 6767 "lint-staged" : {
6868 "*.{js,jsx}" : " eslint --fix"
6969 },
70- "version" : " 0.13.0 "
70+ "version" : " 0.13.1 "
7171}
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 } )
You can’t perform that action at this time.
0 commit comments