@ -27,6 +27,7 @@ const defaultGet = {
name : 'Some User' ,
invitedBy : 'Invited By User' ,
username : 'someuser' ,
orgName : 'Some Org' ,
} ;
async function setupTestContext ( { get = defaultGet } : { get ? : typeof defaultGet | null } = { } ) {
@ -83,7 +84,7 @@ describe('SignupInvitedPage', () => {
/has invited you to join grafana and the organization please complete the following and choose a password to accept your invitation and continue:/i
) ;
expect ( within ( view ) . getByText ( /invited to org name /i ) ) . toBeInTheDocument ( ) ;
expect ( within ( view ) . getByText ( /some org /i ) ) . toBeInTheDocument ( ) ;
} ) ;
it ( 'then the form should include form data' , async ( ) = > {
@ -98,7 +99,9 @@ describe('SignupInvitedPage', () => {
describe ( 'when user submits the form and the required fields are not filled in' , ( ) = > {
it ( 'then required fields should show error messages and nothing should be posted' , async ( ) = > {
const { postSpy } = await setupTestContext ( { get : { email : '' , invitedBy : '' , name : '' , username : '' } } ) ;
const { postSpy } = await setupTestContext ( {
get : { email : '' , invitedBy : '' , name : '' , username : '' , orgName : '' } ,
} ) ;
await userEvent . click ( screen . getByRole ( 'button' , { name : /sign up/i } ) ) ;
@ -123,6 +126,7 @@ describe('SignupInvitedPage', () => {
username : 'some.user@localhost' ,
password : 'pass@word1' ,
inviteCode : 'some code' ,
orgName : 'Some Org' ,
} ) ;
} ) ;
} ) ;