Skip to content

Commit 285ca65

Browse files
committed
fix tests
1 parent f9519f2 commit 285ca65

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

packages/snaps-rpc-methods/src/permitted/createInterface.test.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
Form,
1010
Container,
1111
Footer,
12+
Copyable,
1213
} from '@metamask/snaps-sdk/jsx';
1314
import type { JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils';
1415

@@ -140,7 +141,7 @@ describe('snap_createInterface', () => {
140141
error: {
141142
code: -32602,
142143
message:
143-
'Invalid params: At path: ui -- Expected type to be one of: "Address", "Bold", "Box", "Button", "Copyable", "Divider", "Dropdown", "RadioGroup", "FileInput", "Form", "Heading", "Input", "Image", "Italic", "Link", "Row", "Spinner", "Text", "Tooltip", "Checkbox", "Card", "Icon", "Selector", "Section", "Avatar", "Container", but received: undefined.',
144+
'Invalid params: At path: ui -- Expected type to be one of: "Address", "Bold", "Box", "Button", "Copyable", "Divider", "Dropdown", "RadioGroup", "Field", "FileInput", "Form", "Heading", "Input", "Image", "Italic", "Link", "Row", "Spinner", "Text", "Tooltip", "Checkbox", "Card", "Icon", "Selector", "Section", "Avatar", "Container", but received: undefined.',
144145
stack: expect.any(String),
145146
},
146147
id: 1,
@@ -179,7 +180,7 @@ describe('snap_createInterface', () => {
179180
ui: (
180181
<Box>
181182
<Field label="Input">
182-
<Input name="input" />
183+
<Copyable value="foo" />
183184
</Field>
184185
</Box>
185186
) as JSXElement,
@@ -190,7 +191,7 @@ describe('snap_createInterface', () => {
190191
error: {
191192
code: -32602,
192193
message:
193-
'Invalid params: At path: ui.props.children -- Expected type to be one of: "Address", "Bold", "Box", "Button", "Copyable", "Divider", "Dropdown", "RadioGroup", "FileInput", "Form", "Heading", "Input", "Image", "Italic", "Link", "Row", "Spinner", "Text", "Tooltip", "Checkbox", "Card", "Icon", "Selector", "Section", "Avatar", but received: "Field".',
194+
'Invalid params: At path: ui.props.children.props.children -- Expected the value to satisfy a union of `tuple | tuple | tuple | object | object | object | object | object | object`, but received: [object Object].',
194195
stack: expect.any(String),
195196
},
196197
id: 1,

packages/snaps-simulator/src/features/builder/utils.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
Copyable,
1010
Heading,
1111
Option,
12+
Container,
1213
} from '@metamask/snaps-sdk/jsx';
1314
import type { NodeModel } from '@minoru/react-dnd-treeview';
1415

@@ -30,7 +31,7 @@ describe('isValidBoxChild', () => {
3031
});
3132

3233
it('returns false for invalid box children', () => {
33-
const child = Field({ children: Input({ name: 'input' }) });
34+
const child = Container({ children: Input({ name: 'input' }) });
3435
expect(isValidBoxChild(child)).toBe(false);
3536
});
3637
});
@@ -80,7 +81,7 @@ describe('setElementChildren', () => {
8081
const element = Box({
8182
children: [Text({ children: 'foo' }), Heading({ children: 'baz' })],
8283
});
83-
const children = Field({ children: Input({ name: 'input' }) });
84+
const children = Container({ children: Input({ name: 'input' }) });
8485

8586
const result = setElementChildren(element, children, isValidBoxChild);
8687
expect(result).toStrictEqual(element.props.children);

0 commit comments

Comments
 (0)