scaffolder-react: update useTemplateSchema test to use new test utils

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2026-02-09 19:53:32 +01:00
parent 6bc82ab123
commit 3843732b73
@@ -15,10 +15,9 @@
*/
import { useTemplateSchema } from './useTemplateSchema';
import { renderHook } from '@testing-library/react';
import { TestApiProvider } from '@backstage/test-utils';
import { TestApiProvider } from '@backstage/frontend-test-utils';
import { mockApis } from '@backstage/frontend-test-utils';
import { PropsWithChildren } from 'react';
import { featureFlagsApiRef } from '@backstage/core-plugin-api';
import { TemplateParameterSchema } from '../../types';
describe('useTemplateSchema', () => {
@@ -56,7 +55,7 @@ describe('useTemplateSchema', () => {
const { result } = renderHook(() => useTemplateSchema(manifest), {
wrapper: ({ children }: PropsWithChildren<{}>) => (
<TestApiProvider apis={[[featureFlagsApiRef, mockFeatureFlagsApi]]}>
<TestApiProvider apis={[mockFeatureFlagsApi]}>
{children}
</TestApiProvider>
),
@@ -123,10 +122,7 @@ describe('useTemplateSchema', () => {
wrapper: ({ children }: PropsWithChildren<{}>) => (
<TestApiProvider
apis={[
[
featureFlagsApiRef,
mockApis.featureFlags.mock({ isActive: jest.fn(() => false) }),
],
mockApis.featureFlags.mock({ isActive: jest.fn(() => false) }),
]}
>
{children}
@@ -172,10 +168,7 @@ describe('useTemplateSchema', () => {
wrapper: ({ children }: PropsWithChildren<{}>) => (
<TestApiProvider
apis={[
[
featureFlagsApiRef,
mockApis.featureFlags.mock({ isActive: jest.fn(() => true) }),
],
mockApis.featureFlags.mock({ isActive: jest.fn(() => true) }),
]}
>
{children}
@@ -228,10 +221,7 @@ describe('useTemplateSchema', () => {
wrapper: ({ children }: PropsWithChildren<{}>) => (
<TestApiProvider
apis={[
[
featureFlagsApiRef,
mockApis.featureFlags.mock({ isActive: jest.fn(() => false) }),
],
mockApis.featureFlags.mock({ isActive: jest.fn(() => false) }),
]}
>
{children}
@@ -271,10 +261,7 @@ describe('useTemplateSchema', () => {
wrapper: ({ children }: PropsWithChildren<{}>) => (
<TestApiProvider
apis={[
[
featureFlagsApiRef,
mockApis.featureFlags.mock({ isActive: jest.fn(() => false) }),
],
mockApis.featureFlags.mock({ isActive: jest.fn(() => false) }),
]}
>
{children}
@@ -380,10 +367,7 @@ describe('useTemplateSchema', () => {
wrapper: ({ children }: PropsWithChildren<{}>) => (
<TestApiProvider
apis={[
[
featureFlagsApiRef,
mockApis.featureFlags.mock({ isActive: jest.fn(() => false) }),
],
mockApis.featureFlags.mock({ isActive: jest.fn(() => false) }),
]}
>
{children}