diff --git a/shell/models/__tests__/storage.k8s.io.storageclass.test.ts b/shell/models/__tests__/storage.k8s.io.storageclass.test.ts new file mode 100644 index 00000000000..a1a38befdc3 --- /dev/null +++ b/shell/models/__tests__/storage.k8s.io.storageclass.test.ts @@ -0,0 +1,22 @@ +import StorageClass, { PROVISIONER_OPTIONS } from '@shell/models/storage.k8s.io.storageclass'; + +describe('class StorageClass', () => { + describe('checking if provisionerDisplay', () => { + it.each([ + ['kubernetes.io/azure-disk', true], + ['kubernetes.io/portworx-volume', true], + ['rancher.io/local-path', false], + ['some-random-string-as-provisioner', false], + ])('should NOT show a suffix IF they are built-in (on the PROVISIONER_OPTIONS list)', (provisioner, expectation) => { + const storageClass = new StorageClass({ + metadata: {}, + spec: {}, + provisioner + }); + + jest.spyOn(storageClass, '$rootGetters', 'get').mockReturnValue({ 'i18n/t': jest.fn() }); + + expect(!!PROVISIONER_OPTIONS.find((opt) => opt.value === provisioner)).toBe(expectation); + }); + }); +}); diff --git a/shell/models/storage.k8s.io.storageclass.js b/shell/models/storage.k8s.io.storageclass.js index 35caa5a2550..f65499152c3 100644 --- a/shell/models/storage.k8s.io.storageclass.js +++ b/shell/models/storage.k8s.io.storageclass.js @@ -84,7 +84,7 @@ export const PROVISIONER_OPTIONS = [ export default class extends SteveModel { get provisionerDisplay() { const option = PROVISIONER_OPTIONS.find((o) => o.value === this.provisioner); - const fallback = `${ this.provisioner } ${ this.t('persistentVolume.csi.drivers.suffix') }`; + const fallback = `${ this.provisioner } ${ this.t('persistentVolume.csi.suffix') }`; return option ? this.t(option.labelKey) : this.$rootGetters['i18n/withFallback'](`persistentVolume.csi.drivers.${ this.provisioner.replaceAll('.', '-') }`, null, fallback); }