diff --git a/src/Umbraco.Web.UI.Client/src/mocks/domains/published-status.handlers.ts b/src/Umbraco.Web.UI.Client/src/mocks/domains/published-status.handlers.ts new file mode 100644 index 0000000000..1cef7b9433 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/mocks/domains/published-status.handlers.ts @@ -0,0 +1,24 @@ +import { rest } from 'msw'; + +import umbracoPath from '../../core/helpers/umbraco-path'; + +export const handlers = [ + rest.get(umbracoPath('/published-cache/status'), (_req, res, ctx) => { + return res( + // Respond with a 200 status code + ctx.status(200), + ctx.json( + 'Database cache is ok. ContentStore contains 1 item and has 1 generation and 0 snapshot. MediaStore contains 5 items and has 1 generation and 0 snapshot.' + ) + ); + }), + + rest.post(umbracoPath('/published-cache/reload'), async (_req, res, ctx) => { + await new Promise((resolve) => setTimeout(resolve, (Math.random() + 1) * 1000)); // simulate a delay of 1-2 seconds + + return res( + // Respond with a 200 status code + ctx.status(201) + ); + }), +];