CreateImageWizard: validate the subscription GUID is a valid GUID

This commit is contained in:
Jacob Kozol 2021-11-20 21:52:57 +01:00 committed by Sanne Raymaekers
parent 3e38a71c4a
commit 24a0f39857
2 changed files with 8 additions and 3 deletions

View file

@ -80,6 +80,11 @@ export default {
{
type: validatorTypes.REQUIRED,
},
{
type: validatorTypes.PATTERN,
pattern: /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
message: 'Please enter a valid subscription GUID',
},
],
},
{

View file

@ -275,7 +275,7 @@ describe('Step Upload to Azure', () => {
test('clicking Next loads Registration', () => {
// Randomly generated GUID
userEvent.type(screen.getByTestId('azure-tenant-id'), 'b8f86d22-4371-46ce-95e7-65c415f3b1e2');
userEvent.type(screen.getByTestId('azure-subscription-id'), 'testSubscriptionId');
userEvent.type(screen.getByTestId('azure-subscription-id'), '60631143-a7dc-4d15-988b-ba83f3c99711');
userEvent.type(screen.getByTestId('azure-resource-group'), 'testResourceGroup');
const [ next, , ] = verifyButtons();
@ -617,7 +617,7 @@ describe('Click through all steps', () => {
// Randomly generated GUID
userEvent.type(screen.getByTestId('azure-tenant-id'), 'b8f86d22-4371-46ce-95e7-65c415f3b1e2');
userEvent.type(screen.getByTestId('azure-subscription-id'), 'testSubscriptionId');
userEvent.type(screen.getByTestId('azure-subscription-id'), '60631143-a7dc-4d15-988b-ba83f3c99711');
userEvent.type(screen.getByTestId('azure-resource-group'), 'testResourceGroup');
screen.getByRole('button', { name: /Next/ }).click();
@ -712,7 +712,7 @@ describe('Click through all steps', () => {
type: 'azure',
options: {
tenant_id: 'b8f86d22-4371-46ce-95e7-65c415f3b1e2',
subscription_id: 'testSubscriptionId',
subscription_id: '60631143-a7dc-4d15-988b-ba83f3c99711',
resource_group: 'testResourceGroup',
}
},