storybook-framework-cedarjs
Version:
Storybook for CedarJS
20 lines (19 loc) • 436 B
JavaScript
function mockAuth() {
return {
name: "mock-@cedarjs/auth",
enforce: "pre",
transform(code, id) {
if (id.includes("web/src/auth")) {
code = code.replace(
/(import\s*{\s*[^}]*)(\bcreateAuth\b)(,?)([^}]*})/,
"$1$4"
);
code = "import { createAuthentication as createAuth } from '@cedarjs/testing/auth'\n" + code;
}
return code;
}
};
}
export {
mockAuth
};