Skip to content

Commit

Permalink
test: fix @/storybook imports from jest
Browse files Browse the repository at this point in the history
  • Loading branch information
codeincontext committed Jan 8, 2025
1 parent ccf3219 commit 7aef0ef
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 24 deletions.
2 changes: 1 addition & 1 deletion apps/nextjs/.storybook/chromatic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function chromaticParams(modes: ChromaticModes[]) {
mobile: { viewport: "mobile" },
}),
...(modes.includes("mobile-wide") && {
mobile: { viewport: "mobile-wide" },
"mobile-wide": { viewport: "mobile-wide" },
}),
...(modes.includes("desktop") && {
desktop: { viewport: "desktop" },
Expand Down
1 change: 1 addition & 0 deletions apps/nextjs/jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const config = {
"^(\\.{1,2}/.*)\\.js$": "$1",
"^@/components/(.*)$": "<rootDir>/src/components/$1",
"^@/assets/(.*)$": "<rootDir>/src/assets/$1",
"^@/storybook/(.*)$": "<rootDir>/.storybook/$1",
},
extensionsToTreatAsEsm: [".ts", ".tsx"],
testMatch: ["**/*.test.ts", "**/*.test.tsx"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const meta = {
ailaStreamingStatus: "Idle",
},
parameters: {
...chromaticParams(["mobile", "desktop"]),
...chromaticParams(["desktop"]),
},
} satisfies Meta<typeof ChatMessage>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,6 @@ const { Default, PartiallyCompleted, FullyCompleted, PartialCycles } =
composeStories(stories);

describe("LessonPlanProgressDropdown", () => {
it("renders the Default story with correct closed state", () => {
render(<Default />);
expect(screen.getByText("4 of 10 sections complete")).toBeInTheDocument();
expect(screen.queryByText("Cycles")).not.toBeInTheDocument();
});

it("renders the PartiallyCompleted story with correct closed state", () => {
render(<PartiallyCompleted />);
expect(screen.getByText("7 of 10 sections complete")).toBeInTheDocument();
});

it("renders the FullyCompleted story with correct closed state", () => {
render(<FullyCompleted />);
expect(screen.getByText("10 of 10 sections complete")).toBeInTheDocument();
});

it("renders the PartialCycles story with correct closed state", () => {
render(<PartialCycles />);
expect(screen.getByText("5 of 10 sections complete")).toBeInTheDocument();
});

it("displays the dropdown menu when clicked and shows correct completed sections", async () => {
render(<PartiallyCompleted />);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const meta = {
title: "Components/Onboarding/TermsContent",
component: TermsContent,
parameters: {
...chromaticParams(["mobile", "desktop"]),
...chromaticParams(["desktop"]),
},
} satisfies Meta<typeof TermsContent>;

Expand Down

0 comments on commit 7aef0ef

Please sign in to comment.