Skip to content

Commit bc16878

Browse files
lsongsusexingzhang-suse
authored andcommitted
Unit Tests: Added Registry Dropdown Coverage for "Registry Type Select" and updated test case for "Scan Interval Select"
1 parent ff50647 commit bc16878

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

pkg/sbomscanner/edit/__tests__/sbomscanner.kubewarden.io.registry.spec.ts

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -369,18 +369,31 @@ describe('CruRegistry', () => {
369369
it('Confirm the key-value pair of constants in the select > options', async() => {
370370
wrapper = createWrapper({});
371371

372-
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="1h"]').exists()).toBe(true);
373-
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="1h"]').text()).toBe('Every 1 hour');
374-
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="3h"]').exists()).toBe(true);
375-
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="3h"]').text()).toBe('Every 3 hours');
376-
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="6h"]').exists()).toBe(true);
377-
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="6h"]').text()).toBe('Every 6 hours');
378-
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="12h"]').exists()).toBe(true);
379-
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="12h"]').text()).toBe('Every 12 hours');
380-
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="24h"]').exists()).toBe(true);
381-
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="24h"]').text()).toBe('Every 24 hours');
372+
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="1h0m0s"]').exists()).toBe(true);
373+
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="1h0m0s"]').text()).toBe('Every 1 hour');
374+
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="3h0m0s"]').exists()).toBe(true);
375+
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="3h0m0s"]').text()).toBe('Every 3 hours');
376+
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="6h0m0s"]').exists()).toBe(true);
377+
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="6h0m0s"]').text()).toBe('Every 6 hours');
378+
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="12h0m0s"]').exists()).toBe(true);
379+
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="12h0m0s"]').text()).toBe('Every 12 hours');
380+
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="24h0m0s"]').exists()).toBe(true);
381+
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="24h0m0s"]').text()).toBe('Every 24 hours');
382382
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="0s"]').exists()).toBe(true);
383383
expect(wrapper.find('select[data-testid="registry-scanning-interval-select"] option[value="0s"]').text()).toBe('Manual Scan');
384384
});
385385
});
386+
387+
describe('registry type select', () => {
388+
it('should confirm the key-value pairs of REGISTRY_TYPE_OPTIONS in the select > options', () => {
389+
wrapper = createWrapper({});
390+
391+
// The LabeledSelect stub renders a select with options
392+
expect(wrapper.find('select[data-testid="registry-type-select"] option[value="OCIDistribution"]').exists()).toBe(true);
393+
expect(wrapper.find('select[data-testid="registry-type-select"] option[value="OCIDistribution"]').text()).toBe('OCI Distribution');
394+
395+
expect(wrapper.find('select[data-testid="registry-type-select"] option[value="NoCatalog"]').exists()).toBe(true);
396+
expect(wrapper.find('select[data-testid="registry-type-select"] option[value="NoCatalog"]').text()).toBe('No Catalog');
397+
});
398+
});
386399
});

0 commit comments

Comments
 (0)