From 481c925569a55aba9f9b748c83fb6b5f5d6a2fd6 Mon Sep 17 00:00:00 2001 From: Mandy Parson Date: Thu, 14 Nov 2024 14:16:11 -0700 Subject: [PATCH] MMT-3903: destructuring and test fix --- .../TemplateForm/__tests__/TemplateForm.test.jsx | 12 ++++++++++-- .../__tests__/TemplatePreview.test.jsx | 4 +++- static/src/js/schemas/umm/ummCSchema.js | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/static/src/js/components/TemplateForm/__tests__/TemplateForm.test.jsx b/static/src/js/components/TemplateForm/__tests__/TemplateForm.test.jsx index dca3a4321..78c6985b2 100644 --- a/static/src/js/components/TemplateForm/__tests__/TemplateForm.test.jsx +++ b/static/src/js/components/TemplateForm/__tests__/TemplateForm.test.jsx @@ -46,6 +46,14 @@ import useAvailableProviders from '@/js/hooks/useAvailableProviders' import TemplateForm from '../TemplateForm' +import staticConfig from '../../../../../../static.config.json' + +const getConfig = () => staticConfig + +const { ummVersions } = getConfig() + +const { ummC: ummCVersion } = ummVersions + vi.mock('@/js/utils/createTemplate') vi.mock('@/js/utils/errorLogger') vi.mock('@/js/utils/getTemplate') @@ -503,7 +511,7 @@ describe('TemplateForm', () => { }, nativeId: 'MMT_mock-uuid', providerId: 'MMT_2', - ummVersion: '1.18.1' + ummVersion: `${ummCVersion}` } }, result: { @@ -557,7 +565,7 @@ describe('TemplateForm', () => { }, nativeId: 'MMT_mock-uuid', providerId: 'MMT_2', - ummVersion: '1.18.1' + ummVersion: `${ummCVersion}` } }, error: new Error('An error occurred') diff --git a/static/src/js/components/TemplatePreview/__tests__/TemplatePreview.test.jsx b/static/src/js/components/TemplatePreview/__tests__/TemplatePreview.test.jsx index bd4711a65..9d4572f6a 100644 --- a/static/src/js/components/TemplatePreview/__tests__/TemplatePreview.test.jsx +++ b/static/src/js/components/TemplatePreview/__tests__/TemplatePreview.test.jsx @@ -34,7 +34,9 @@ vi.mock('../../../utils/deleteTemplate') const getConfig = () => staticConfig -const ummCVersion = getConfig().ummVersions.ummC +const { ummVersions } = getConfig() + +const { ummC: ummCVersion } = ummVersions const setup = () => { const user = userEvent.setup() diff --git a/static/src/js/schemas/umm/ummCSchema.js b/static/src/js/schemas/umm/ummCSchema.js index 083f68337..6854892b3 100644 --- a/static/src/js/schemas/umm/ummCSchema.js +++ b/static/src/js/schemas/umm/ummCSchema.js @@ -2,7 +2,9 @@ import staticConfig from '../../../../../static.config.json' const getConfig = () => staticConfig -const ummCVersion = getConfig().ummVersions.ummC +const { ummVersions } = getConfig() + +const { ummC: ummCVersion } = ummVersions const ummCSchema = { $schema: 'http://json-schema.org/draft-07/schema#',