Uploaded image for project: 'Nuxeo Elements'
  1. Nuxeo Elements
  2. ELEMENTS-1120

Storybook Mocking Strategy

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0-SNAPSHOT
    • Fix Version/s: 3.0.x
    • Component/s: Catalog, Demos, UI

      Description

      While moving the first set of elements from WebUI to Nuxeo-Elements ( ELEMENTS-1105) we found that we would need a smart way (and consistent between Unit Tests and Storybook) to mock data.

      We did some evolutions to our MockClient but there is still some work to done on Storybook side since we are sharing the same instance which may lead to issues when we have a need to mock the same REST call, for instance, in different stories with different expectations.

      Some exploratory work was done by taking into account Storybook API (https://storybook.js.org/docs/addons/api/) and it's core events (https://github.com/storybookjs/storybook/blob/master/lib/core-events/src/index.ts) and the main challenge is to ensure we have a way to "setup" and "teardown" our MockClient in each story.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ncunha Nuno Cunha
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: