Commit c9d2f0ee authored by Alexander Turinske's avatar Alexander Turinske

Fix forEach tests for all formGroups

parent af8a8978
......@@ -285,19 +285,21 @@ describe('DAST Scanner Profile', () => {
});
describe('when profile does not come from a policy', () => {
let formGroups;
beforeEach(() => {
createComponent({
propsData: {
profile: defaultProfile,
},
});
formGroups = findAllFormGroups().wrappers;
});
it('should enable all form groups', () => {
const formGroups = findAllFormGroups();
for (let i = 0; i < formGroups.length; i += 1) {
expect(formGroups.at(i).attributes('disabled')).toBe(undefined);
}
formGroups.forEach((formGroup) => {
expect(formGroup.attributes('disabled')).toBe(undefined);
});
});
it('should show the policy profile alert', () => {
......@@ -306,12 +308,15 @@ describe('DAST Scanner Profile', () => {
});
describe('when profile does comes from a policy', () => {
let formGroups;
beforeEach(() => {
createComponent({
propsData: {
profile: policyScannerProfile,
},
});
formGroups = findAllFormGroups().wrappers;
});
it('should show the policy profile alert', () => {
......@@ -319,10 +324,9 @@ describe('DAST Scanner Profile', () => {
});
it('should disable all form groups', () => {
const formGroups = findAllFormGroups();
for (let i = 0; i < formGroups.length; i += 1) {
expect(formGroups.at(i).attributes('disabled')).toBe('true');
}
formGroups.forEach((formGroup) => {
expect(formGroup.attributes('disabled')).toBe('true');
});
});
it('should disable the save button', () => {
......
......@@ -121,20 +121,20 @@ describe('DastSiteAuthSection', () => {
describe('when profile does not come from a policy', () => {
it('should enable all form groups', () => {
createComponent({ mountFn: shallowMount, fields: { enabled: true } });
const formGroups = findAllFormGroups();
for (let i = 0; i < formGroups.length; i += 1) {
expect(formGroups.at(i).attributes('disabled')).toBe(undefined);
}
const formGroups = findAllFormGroups().wrappers;
formGroups.forEach((formGroup) => {
expect(formGroup.attributes('disabled')).toBe(undefined);
});
});
});
describe('when profile does comes from a policy', () => {
it('should disable all form groups', () => {
createComponent({ mountFn: shallowMount, disabled: true, fields: { enabled: true } });
const formGroups = findAllFormGroups();
for (let i = 0; i < formGroups.length; i += 1) {
expect(formGroups.at(i).attributes('disabled')).toBe('true');
}
const formGroups = findAllFormGroups().wrappers;
formGroups.forEach((formGroup) => {
expect(formGroup.attributes('disabled')).toBe('true');
});
});
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment