minutework 0.1.28 → 0.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,9 @@
1
- import { beforeEach, describe, expect, it, vi } from "vitest";
1
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
2
2
 
3
3
  const getMarketingPage = vi.fn();
4
4
  const getSiteConfig = vi.fn();
5
+ const redirect = vi.fn();
6
+ const originalPublicContentSource = process.env.MW_PUBLIC_CONTENT_SOURCE;
5
7
 
6
8
  vi.mock("@/features/public-shell/components/marketing-page-canvas", () => ({
7
9
  MarketingPageCanvas: () => null,
@@ -17,15 +19,28 @@ vi.mock("@/lib/content/adapter.server", () => ({
17
19
  }));
18
20
 
19
21
  vi.mock("next/navigation", () => ({
20
- notFound: vi.fn(),
22
+ redirect,
21
23
  }));
22
24
 
23
25
  describe("home page", () => {
24
26
  beforeEach(() => {
27
+ if (originalPublicContentSource === undefined) {
28
+ delete process.env.MW_PUBLIC_CONTENT_SOURCE;
29
+ } else {
30
+ process.env.MW_PUBLIC_CONTENT_SOURCE = originalPublicContentSource;
31
+ }
25
32
  vi.clearAllMocks();
26
33
  vi.resetModules();
27
34
  });
28
35
 
36
+ afterEach(() => {
37
+ if (originalPublicContentSource === undefined) {
38
+ delete process.env.MW_PUBLIC_CONTENT_SOURCE;
39
+ } else {
40
+ process.env.MW_PUBLIC_CONTENT_SOURCE = originalPublicContentSource;
41
+ }
42
+ });
43
+
29
44
  it("renders public home content without auth redirects", async () => {
30
45
  getSiteConfig.mockResolvedValue({
31
46
  siteName: "MinuteWork Combined Starter",
@@ -57,4 +72,19 @@ describe("home page", () => {
57
72
 
58
73
  await expect(page.default()).resolves.toBeDefined();
59
74
  });
75
+
76
+ it("redirects the private-only root route to /app", async () => {
77
+ vi.resetModules();
78
+ process.env.MW_PUBLIC_CONTENT_SOURCE = "none";
79
+ redirect.mockImplementation(() => {
80
+ throw new Error("NEXT_REDIRECT");
81
+ });
82
+
83
+ const page = await import("./page");
84
+
85
+ await expect(page.default()).rejects.toThrow("NEXT_REDIRECT");
86
+ expect(redirect).toHaveBeenCalledWith("/app");
87
+ expect(getSiteConfig).not.toHaveBeenCalled();
88
+ expect(getMarketingPage).not.toHaveBeenCalled();
89
+ });
60
90
  });
@@ -1,4 +1,4 @@
1
- import { notFound } from "next/navigation";
1
+ import { redirect } from "next/navigation";
2
2
 
3
3
  import { MarketingPageCanvas } from "@/features/public-shell/components/marketing-page-canvas";
4
4
  import { PublicSiteShell } from "@/features/public-shell/components/public-site-shell";
@@ -32,7 +32,7 @@ export async function generateMetadata() {
32
32
 
33
33
  export default async function HomePage() {
34
34
  if (isPublicContentDisabled()) {
35
- notFound();
35
+ redirect(appRoutes.appHome);
36
36
  }
37
37
 
38
38
  const [siteConfig, page] = await Promise.all([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minutework",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "MinuteWork CLI for workspace scaffolding, local preview workflows, and hosted preview deploys.",
5
5
  "type": "module",
6
6
  "bin": {