Inclusion Mode
Sometimes, you have an existing spartacus project, where you don't want or cannot add mock-data for everything. Still it would be nice to quickly mock a page with a new component / a new endpoint. Don't worry, we have you covered:
Mock only certain endpoints
Add the property
inclusionMode: true
to the mockConfig in yourmain.ts
fileFollow the steps described in Define Routes for Endpoints and / or Add Handlers for Endpoints to add a route / handler for your endpoint
Define an Array where you specify the request that you want to mock (this is needed, as in Inclusion Mode, all requested go through by default)
Add everything to your mockConfig
Mock only certain pages
Add the property
inclusionMode: true
to the mockConfig in yourmain.ts
file and set the propertyexclusionMode
tofalse
Follow the steps described in Add custom pages or override default pages to add a custom page
Define an Array where you specify the request that you want to mock (this is needed, as in the Inclusion Mode, all requested go through by default)
Define a string array with the
pageId
of the page that you want to mock (this is needed, as for the other pages, thepages
call still needs to go through)mockedPageIds: ['hello-world']
Add everything to your mockConfig
Last updated