UNPKG

@wordpress/e2e-test-utils

Version:
25 lines (24 loc) 587 B
import { rest, batch } from "./rest-api"; async function deleteAllWidgets() { const [widgets, sidebars] = await Promise.all([ rest({ path: "/wp/v2/widgets" }), rest({ path: "/wp/v2/sidebars" }) ]); await batch( widgets.map((widget) => ({ method: "DELETE", path: `/wp/v2/widgets/${widget.id}?force=true` })) ); await batch( sidebars.map((sidebar) => ({ method: "POST", path: `/wp/v2/sidebars/${sidebar.id}`, body: { id: sidebar.id, widgets: [] } })) ); } export { deleteAllWidgets }; //# sourceMappingURL=widgets.js.map