novuhq / novu

Open-Source Notification Platform. Embeddable Notification Center, E-mail, Push and Slack Integrations.
https://novu.co
Other
35.43k stars 3.92k forks source link

test(framework): Add test for step results in control values during preview #7034

Closed rifont closed 4 days ago

rifont commented 4 days ago

What changed? Why was the change needed?

Screenshots

Example of working code under test:

const newWorkflow = workflow('test-workflow', async ({ step }) => {
  await step.inApp('in-app', async () => ({
    body: 'In App Body',
  }));

  await step.delay('delay', async () => ({ amount: 1, unit: 'hours' }));

  await step.email(
    'send-email',
    async (controls) => {
      return {
        subject: 'Test Subject',
        body: controls.body,
      };
    },
    {
      controlSchema: {
        type: 'object',
        properties: {
          body: {
            type: 'string',
            default: `In app message was {{steps.in-app.seen}}.`, // 👈 can use `steps.{step-id}.{resultKey}`
          },
        },
        required: ['body'],
        additionalProperties: false,
      } as const,
    }
  );
});
Expand for optional sections ### Related enterprise PR ### Special notes for your reviewer
netlify[bot] commented 4 days ago

Deploy Preview for novu-stg-vite-dashboard-poc ready!

Name Link
Latest commit 5155d65e7459cdbac5c7e3caceb16a681cbc8504
Latest deploy log https://app.netlify.com/sites/novu-stg-vite-dashboard-poc/deploys/673a71dde3a7b100080ab608
Deploy Preview https://deploy-preview-7034--novu-stg-vite-dashboard-poc.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.