Skip to content

Commit

Permalink
Add tests and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Mar 1, 2024
1 parent c813f09 commit 255d810
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ describe('assertIsOnUserInputRequestArguments', () => {
value: { foo: 'bar' },
},
},
{
id: 'foo',
event: {
type: UserInputEventType.InputChangeEvent,
name: 'input',
value: 'bar',
},
},
])('does not throw for a valid user input param object', (value) => {
expect(() => assertIsOnUserInputRequestArguments(value)).not.toThrow();
});
Expand Down
3 changes: 2 additions & 1 deletion packages/snaps-sdk/src/types/handlers/user-input.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { UserInputEventType } from './user-input';

describe('UserInputEventType', () => {
it('has the correct values', () => {
expect(Object.values(UserInputEventType)).toHaveLength(2);
expect(Object.values(UserInputEventType)).toHaveLength(3);
expect(UserInputEventType.ButtonClickEvent).toBe('ButtonClickEvent');
expect(UserInputEventType.FormSubmitEvent).toBe('FormSubmitEvent');
expect(UserInputEventType.InputChangeEvent).toBe('InputChangeEvent');
});
});
3 changes: 2 additions & 1 deletion packages/snaps-sdk/src/types/handlers/user-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import {

/**
* The type of user input event fired.
* Currently only two events are supported:
* Currently only three events are supported:
*
* - `ButtonClickEvent` - A button has been clicked in the UI.
* - `FormSubmitEvent` - A Form has been submitted in the UI.
* - `InputChangeEvent` - The value of an input field has changed in the UI.
*/
export enum UserInputEventType {
ButtonClickEvent = 'ButtonClickEvent',
Expand Down

0 comments on commit 255d810

Please sign in to comment.