Skip to content

Commit

Permalink
test(form): mock uirecipes
Browse files Browse the repository at this point in the history
  • Loading branch information
ingeridhellen committed Aug 4, 2023
1 parent e82bbd4 commit fa87004
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
13 changes: 13 additions & 0 deletions packages/dm-core-plugins/src/form/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ export const mockBlueprintGet = (blueprints: Array<any>) => {
blueprint: blueprints.find(
(blueprint: any) => blueprint.name == props.typeRef
),
uiRecipes: [
{
name: 'Edit',
type: 'dmss://system/SIMOS/UiRecipe',
plugin: '@development-framework/dm-core-plugins/form',
},
{
name: 'List',
type: 'dmss://system/SIMOS/UiRecipe',
plugin: '@development-framework/dm-core-plugins/list',
dimensions: '*',
},
],
},
})
)
Expand Down
15 changes: 5 additions & 10 deletions packages/dm-core/src/hooks/useRecipe.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useContext, useEffect, useState } from 'react'
import { useContext, useEffect, useState } from 'react'
import {
useBlueprint,
TUiRecipe,
ErrorResponse,
UiPluginContext,
IUIPlugin,
TUiRecipe,
UiPluginContext,
useBlueprint,
} from '../index'

const findRecipe = (
Expand Down Expand Up @@ -51,12 +51,7 @@ const findRecipe = (
)
return noDimensionsRecipes[0]
}
return {
type: 'CORE:UIRecipe',
name: 'yaml',
plugin: 'yaml',
config: {},
}
throw new Error(`No uiRecipe was found`)
}

interface IUseRecipe {
Expand Down

0 comments on commit fa87004

Please sign in to comment.