Skip to content

Commit 73a2ba4

Browse files
Fix more tests
1 parent a96e404 commit 73a2ba4

File tree

5 files changed

+41
-44
lines changed

5 files changed

+41
-44
lines changed

packages/snaps-simulation/src/interface.test.tsx

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ describe('clickElement', () => {
555555

556556
it('sends a ButtonClickEvent to the snap', async () => {
557557
const content = button({ value: 'foo', name: 'bar' });
558-
const interfaceId = await interfaceController.createInterface(
558+
const interfaceId = interfaceController.createInterface(
559559
MOCK_SNAP_ID,
560560
content,
561561
);
@@ -592,7 +592,7 @@ describe('clickElement', () => {
592592
button({ value: 'baz', name: 'baz', buttonType: ButtonType.Submit }),
593593
]);
594594

595-
const interfaceId = await interfaceController.createInterface(
595+
const interfaceId = interfaceController.createInterface(
596596
MOCK_SNAP_ID,
597597
content,
598598
);
@@ -657,7 +657,7 @@ describe('clickElement', () => {
657657
</Box>
658658
);
659659

660-
const interfaceId = await interfaceController.createInterface(
660+
const interfaceId = interfaceController.createInterface(
661661
MOCK_SNAP_ID,
662662
content,
663663
);
@@ -718,7 +718,7 @@ describe('clickElement', () => {
718718
</Form>
719719
);
720720

721-
const interfaceId = await interfaceController.createInterface(
721+
const interfaceId = interfaceController.createInterface(
722722
MOCK_SNAP_ID,
723723
content,
724724
);
@@ -781,7 +781,7 @@ describe('clickElement', () => {
781781
it('throws if there is no button with the given name in the interface', async () => {
782782
const content = button({ value: 'foo', name: 'foo' });
783783

784-
const interfaceId = await interfaceController.createInterface(
784+
const interfaceId = interfaceController.createInterface(
785785
MOCK_SNAP_ID,
786786
content,
787787
);
@@ -804,7 +804,7 @@ describe('clickElement', () => {
804804
it('throws if the element is not a button', async () => {
805805
const content = input({ value: 'foo', name: 'foo' });
806806

807-
const interfaceId = await interfaceController.createInterface(
807+
const interfaceId = interfaceController.createInterface(
808808
MOCK_SNAP_ID,
809809
content,
810810
);
@@ -827,7 +827,7 @@ describe('clickElement', () => {
827827
it('unwraps errors', async () => {
828828
const content = button({ value: 'foo', name: 'foo' });
829829

830-
const interfaceId = await interfaceController.createInterface(
830+
const interfaceId = interfaceController.createInterface(
831831
MOCK_SNAP_ID,
832832
content,
833833
);
@@ -889,7 +889,7 @@ describe('typeInField', () => {
889889

890890
const content = input('bar');
891891

892-
const interfaceId = await interfaceController.createInterface(
892+
const interfaceId = interfaceController.createInterface(
893893
MOCK_SNAP_ID,
894894
content,
895895
);
@@ -938,7 +938,7 @@ describe('typeInField', () => {
938938
/>
939939
);
940940

941-
const interfaceId = await interfaceController.createInterface(
941+
const interfaceId = interfaceController.createInterface(
942942
MOCK_SNAP_ID,
943943
content,
944944
);
@@ -980,7 +980,7 @@ describe('typeInField', () => {
980980
it('throws if there is no inputs in the interface', async () => {
981981
const content = text('bar');
982982

983-
const interfaceId = await interfaceController.createInterface(
983+
const interfaceId = interfaceController.createInterface(
984984
MOCK_SNAP_ID,
985985
content,
986986
);
@@ -1002,7 +1002,7 @@ describe('typeInField', () => {
10021002
it('throws if the element is not an input', async () => {
10031003
const content = button({ value: 'foo', name: 'foo' });
10041004

1005-
const interfaceId = await interfaceController.createInterface(
1005+
const interfaceId = interfaceController.createInterface(
10061006
MOCK_SNAP_ID,
10071007
content,
10081008
);
@@ -1049,7 +1049,7 @@ describe('selectInDropdown', () => {
10491049
</Dropdown>
10501050
);
10511051

1052-
const interfaceId = await interfaceController.createInterface(
1052+
const interfaceId = interfaceController.createInterface(
10531053
MOCK_SNAP_ID,
10541054
content,
10551055
);
@@ -1096,7 +1096,7 @@ describe('selectInDropdown', () => {
10961096
</Dropdown>
10971097
);
10981098

1099-
const interfaceId = await interfaceController.createInterface(
1099+
const interfaceId = interfaceController.createInterface(
11001100
MOCK_SNAP_ID,
11011101
content,
11021102
);
@@ -1122,7 +1122,7 @@ describe('selectInDropdown', () => {
11221122
</Box>
11231123
);
11241124

1125-
const interfaceId = await interfaceController.createInterface(
1125+
const interfaceId = interfaceController.createInterface(
11261126
MOCK_SNAP_ID,
11271127
content,
11281128
);
@@ -1144,7 +1144,7 @@ describe('selectInDropdown', () => {
11441144
it('throws if the element is not a dropdown', async () => {
11451145
const content = <Input name="foo" />;
11461146

1147-
const interfaceId = await interfaceController.createInterface(
1147+
const interfaceId = interfaceController.createInterface(
11481148
MOCK_SNAP_ID,
11491149
content,
11501150
);
@@ -1188,7 +1188,7 @@ describe('uploadFile', () => {
11881188
</Box>
11891189
);
11901190

1191-
const interfaceId = await interfaceController.createInterface(
1191+
const interfaceId = interfaceController.createInterface(
11921192
MOCK_SNAP_ID,
11931193
content,
11941194
);
@@ -1249,7 +1249,7 @@ describe('uploadFile', () => {
12491249
</Box>
12501250
);
12511251

1252-
const interfaceId = await interfaceController.createInterface(
1252+
const interfaceId = interfaceController.createInterface(
12531253
MOCK_SNAP_ID,
12541254
content,
12551255
);
@@ -1307,7 +1307,7 @@ describe('uploadFile', () => {
13071307
</Box>
13081308
);
13091309

1310-
const interfaceId = await interfaceController.createInterface(
1310+
const interfaceId = interfaceController.createInterface(
13111311
MOCK_SNAP_ID,
13121312
content,
13131313
);
@@ -1341,7 +1341,7 @@ describe('getInterface', () => {
13411341
const { store, runSaga } = createStore(options);
13421342

13431343
const content = text('foo');
1344-
const id = await interfaceController.createInterface(MOCK_SNAP_ID, content);
1344+
const id = interfaceController.createInterface(MOCK_SNAP_ID, content);
13451345
const type = DialogType.Alert;
13461346
const ui = { type: DIALOG_APPROVAL_TYPES[type], id };
13471347

@@ -1382,7 +1382,7 @@ describe('getInterface', () => {
13821382
).toPromise();
13831383

13841384
const content = text('foo');
1385-
const id = await interfaceController.createInterface(MOCK_SNAP_ID, content);
1385+
const id = interfaceController.createInterface(MOCK_SNAP_ID, content);
13861386
const type = DialogType.Alert;
13871387
const ui = { type: DIALOG_APPROVAL_TYPES[type], id };
13881388
store.dispatch(setInterface(ui));
@@ -1409,7 +1409,7 @@ describe('getInterface', () => {
14091409
const { store, runSaga } = createStore(options);
14101410

14111411
const content = button({ value: 'foo', name: 'foo' });
1412-
const id = await interfaceController.createInterface(MOCK_SNAP_ID, content);
1412+
const id = interfaceController.createInterface(MOCK_SNAP_ID, content);
14131413
const type = DialogType.Alert;
14141414
const ui = { type: DIALOG_APPROVAL_TYPES[type], id };
14151415

@@ -1453,7 +1453,7 @@ describe('getInterface', () => {
14531453
const { store, runSaga } = createStore(options);
14541454

14551455
const content = input('foo');
1456-
const id = await interfaceController.createInterface(MOCK_SNAP_ID, content);
1456+
const id = interfaceController.createInterface(MOCK_SNAP_ID, content);
14571457
const type = DialogType.Alert;
14581458
const ui = { type: DIALOG_APPROVAL_TYPES[type], id };
14591459

@@ -1503,7 +1503,7 @@ describe('getInterface', () => {
15031503
<Option value="option2">Option 2</Option>
15041504
</Dropdown>
15051505
);
1506-
const id = await interfaceController.createInterface(MOCK_SNAP_ID, content);
1506+
const id = interfaceController.createInterface(MOCK_SNAP_ID, content);
15071507
const type = DialogType.Alert;
15081508
const ui = { type: DIALOG_APPROVAL_TYPES[type], id };
15091509

@@ -1552,7 +1552,7 @@ describe('getInterface', () => {
15521552
<FileInput name="foo" />
15531553
</Box>
15541554
);
1555-
const id = await interfaceController.createInterface(MOCK_SNAP_ID, content);
1555+
const id = interfaceController.createInterface(MOCK_SNAP_ID, content);
15561556
const type = DialogType.Alert;
15571557
const ui = { type: DIALOG_APPROVAL_TYPES[type], id };
15581558

@@ -1606,7 +1606,7 @@ describe('getInterface', () => {
16061606
<Input name="foo" />
16071607
</Box>
16081608
);
1609-
const id = await interfaceController.createInterface(MOCK_SNAP_ID, content);
1609+
const id = interfaceController.createInterface(MOCK_SNAP_ID, content);
16101610
const type = DialogType.Alert;
16111611
const ui = { type: DIALOG_APPROVAL_TYPES[type], id };
16121612

@@ -1622,7 +1622,7 @@ describe('getInterface', () => {
16221622

16231623
const promise = result.waitForUpdate();
16241624

1625-
await interfaceController.updateInterface(
1625+
interfaceController.updateInterface(
16261626
MOCK_SNAP_ID,
16271627
id,
16281628
<Text>Hello world!</Text>,
@@ -1661,7 +1661,7 @@ describe('selectFromRadioGroup', () => {
16611661
</RadioGroup>
16621662
);
16631663

1664-
const interfaceId = await interfaceController.createInterface(
1664+
const interfaceId = interfaceController.createInterface(
16651665
MOCK_SNAP_ID,
16661666
content,
16671667
);
@@ -1708,7 +1708,7 @@ describe('selectFromRadioGroup', () => {
17081708
</RadioGroup>
17091709
);
17101710

1711-
const interfaceId = await interfaceController.createInterface(
1711+
const interfaceId = interfaceController.createInterface(
17121712
MOCK_SNAP_ID,
17131713
content,
17141714
);
@@ -1734,7 +1734,7 @@ describe('selectFromRadioGroup', () => {
17341734
</Box>
17351735
);
17361736

1737-
const interfaceId = await interfaceController.createInterface(
1737+
const interfaceId = interfaceController.createInterface(
17381738
MOCK_SNAP_ID,
17391739
content,
17401740
);
@@ -1756,7 +1756,7 @@ describe('selectFromRadioGroup', () => {
17561756
it('throws if the element is not a RadioGroup', async () => {
17571757
const content = <Input name="foo" />;
17581758

1759-
const interfaceId = await interfaceController.createInterface(
1759+
const interfaceId = interfaceController.createInterface(
17601760
MOCK_SNAP_ID,
17611761
content,
17621762
);
@@ -1943,7 +1943,7 @@ describe('selectFromSelector', () => {
19431943
</Selector>
19441944
);
19451945

1946-
const interfaceId = await interfaceController.createInterface(
1946+
const interfaceId = interfaceController.createInterface(
19471947
MOCK_SNAP_ID,
19481948
content,
19491949
);
@@ -1997,7 +1997,7 @@ describe('selectFromSelector', () => {
19971997
</Selector>
19981998
);
19991999

2000-
const interfaceId = await interfaceController.createInterface(
2000+
const interfaceId = interfaceController.createInterface(
20012001
MOCK_SNAP_ID,
20022002
content,
20032003
);
@@ -2026,7 +2026,7 @@ describe('selectFromSelector', () => {
20262026
</Box>
20272027
);
20282028

2029-
const interfaceId = await interfaceController.createInterface(
2029+
const interfaceId = interfaceController.createInterface(
20302030
MOCK_SNAP_ID,
20312031
content,
20322032
);
@@ -2051,7 +2051,7 @@ describe('selectFromSelector', () => {
20512051

20522052
const content = <Input name="foo" />;
20532053

2054-
const interfaceId = await interfaceController.createInterface(
2054+
const interfaceId = interfaceController.createInterface(
20552055
MOCK_SNAP_ID,
20562056
content,
20572057
);
@@ -2087,7 +2087,7 @@ describe('waitForUpdate', () => {
20872087
it('waits for the interface content to update', async () => {
20882088
const content = <Input name="foo" />;
20892089

2090-
const interfaceId = await interfaceController.createInterface(
2090+
const interfaceId = interfaceController.createInterface(
20912091
MOCK_SNAP_ID,
20922092
content,
20932093
);
@@ -2100,7 +2100,7 @@ describe('waitForUpdate', () => {
21002100
content,
21012101
);
21022102

2103-
await interfaceController.updateInterface(
2103+
interfaceController.updateInterface(
21042104
MOCK_SNAP_ID,
21052105
interfaceId,
21062106
<Text>Hello world!</Text>,

packages/snaps-simulation/src/methods/hooks/interface.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe('getGetInterfaceImplementation', () => {
5858

5959
const content = text('bar');
6060

61-
const id = await interfaceController.createInterface(MOCK_SNAP_ID, content);
61+
const id = interfaceController.createInterface(MOCK_SNAP_ID, content);
6262

6363
const result = fn(MOCK_SNAP_ID, id);
6464

packages/snaps-simulation/src/request.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ describe('handleRequest', () => {
144144
});
145145

146146
const content = text('foo');
147-
const id = await interfaceController.createInterface(
147+
const id = interfaceController.createInterface(
148148
'local:http://localhost:4242' as SnapId,
149149
content,
150150
);
@@ -362,7 +362,7 @@ describe('getInterfaceApi', () => {
362362
});
363363
const content = text('foo');
364364

365-
const id = await interfaceController.createInterface(MOCK_SNAP_ID, content);
365+
const id = interfaceController.createInterface(MOCK_SNAP_ID, content);
366366

367367
const getInterface = await getInterfaceApi(
368368
{ id },

packages/snaps-simulation/src/request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export async function getInterfaceFromResult(
213213
'The Snap returned an invalid interface.',
214214
);
215215

216-
const id = await controllerMessenger.call(
216+
const id = controllerMessenger.call(
217217
'SnapInterfaceController:createInterface',
218218
snapId,
219219
result.content as ComponentOrElement,

packages/snaps-simulation/src/simulation.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,10 +629,7 @@ describe('getPermittedHooks', () => {
629629

630630
const snapFiles = await fetchSnap(snapId, location);
631631

632-
const id = await snapInterfaceController.createInterface(
633-
snapId,
634-
text('foo'),
635-
);
632+
const id = snapInterfaceController.createInterface(snapId, text('foo'));
636633

637634
const { resolveInterface } = getPermittedHooks(
638635
snapId,

0 commit comments

Comments
 (0)