@@ -4,6 +4,7 @@ import { screen } from '@testing-library/react';
44
55import * as Cm from '.../../../../components/addSourceWizard/hardcodedComponents/azure/costManagement' ;
66import RenderContext from '@data-driven-forms/react-form-renderer/renderer-context' ;
7+ import Form from '@data-driven-forms/react-form-renderer/form' ;
78import render from '../../__mocks__/render' ;
89
910describe ( 'Cost Management Azure steps components' , ( ) => {
@@ -32,7 +33,19 @@ describe('Cost Management Azure steps components', () => {
3233 } ) ;
3334
3435 it ( 'Configure Roles description' , ( ) => {
35- render ( < Cm . ConfigureRolesDescription /> ) ;
36+ render (
37+ < RenderContext . Provider
38+ value = { {
39+ formOptions : {
40+ getState : ( ) => ( {
41+ values : { application : { extra : { subscription_id : 'my-sub-id-1' , resource_group : 'my-resource-group-1' } } } ,
42+ } ) ,
43+ } ,
44+ } }
45+ >
46+ < Cm . ConfigureRolesDescription />
47+ </ RenderContext . Provider >
48+ ) ;
3649
3750 expect (
3851 screen . getByText (
@@ -47,24 +60,30 @@ describe('Cost Management Azure steps components', () => {
4760 )
4861 ) . toBeInTheDocument ( ) ;
4962 expect ( screen . getByLabelText ( 'Copyable input' ) ) . toHaveValue (
50- `az ad sp create-for-rbac -n "CostManagement" --role "Storage Account Contributor" --query '{"tenant": tenant, "client_id": appId, "secret": password}'`
63+ `az ad sp create-for-rbac -n "CostManagement" --role "Storage Account Contributor" --scope /subscriptions/my-sub-id-1/resourceGroups/my-resource-group-1 --query '{"tenant": tenant, "client_id": appId, "secret": password}'`
5164 ) ;
5265 } ) ;
5366
5467 it ( 'Read Role description' , ( ) => {
5568 render (
56- < RenderContext . Provider
57- value = { { formOptions : { getState : ( ) => ( { values : { application : { extra : { subscription_id : 'my-sub-id-1' } } } } ) } } }
58- >
59- < Cm . ReaderRoleDescription />
60- </ RenderContext . Provider >
69+ < Form onSubmit = { jest . fn ( ) } >
70+ { ( ) => (
71+ < RenderContext . Provider
72+ value = { {
73+ formOptions : { getState : ( ) => ( { values : { authentication : { username : 'some-user-name' } } } ) } ,
74+ } }
75+ >
76+ < Cm . ReaderRoleDescription />
77+ </ RenderContext . Provider >
78+ ) }
79+ </ Form >
6180 ) ;
6281
6382 expect (
6483 screen . getByText ( 'Run the following command in Cloud Shell to create a Cost Management Reader role:' )
6584 ) . toBeInTheDocument ( ) ;
6685 expect ( screen . getByLabelText ( 'Copyable input' ) ) . toHaveValue (
67- `az role assignment create --role "Cost Management Reader " --assignee http://CostManagement --subscription my-sub-id-1 `
86+ `az role assignment create --assignee "some-user-name " --role "Cost Management Reader" `
6887 ) ;
6988 } ) ;
7089
0 commit comments