Skip to content

Commit 7578486

Browse files
committed
build: adds test to check entrypoint other than string
1 parent 46581d5 commit 7578486

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/Event.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,4 +558,32 @@ describe('Event', () => {
558558
expect(fn3).not.toHaveBeenCalled();
559559
expect(next).toEqual(createFormHub().forms.multi);
560560
});
561+
562+
it('entrypoint other than a string', async () => {
563+
const producer = FormEventProducer.fromFormHub({
564+
entrypoint: {
565+
form: 'test',
566+
initialArgs: {
567+
myVal: 4,
568+
},
569+
},
570+
forms: {
571+
test: {
572+
type: 'multi-button',
573+
title: 'myVal is: {myVal}',
574+
elements: [],
575+
},
576+
},
577+
});
578+
579+
const next = await triggerEvent(producer, {});
580+
581+
expect(next).toEqual({
582+
type: 'multi-button',
583+
title: 'myVal is: {myVal}',
584+
elements: [],
585+
});
586+
587+
expect(producer.args.resolveTemplate('myVal is: {myVal}')).toBe('myVal is: 4');
588+
});
561589
});

0 commit comments

Comments
 (0)