Skip to content

Commit

Permalink
Refactor and separate tests from Jest and Playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchernchong committed Nov 9, 2024
1 parent da0c3cc commit 6fc1dfb
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ const createJestConfig = nextJest({ dir: "./" });
const customJestConfig = {
collectCoverage: true,
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
testMatch: [
"<rootDir>/tests/**/*.test.{js,jsx,ts,tsx}",
"<rootDir>/src/**/*.test.{js,jsx,ts,tsx}",
"!<rootDir>/e2e/**/*",
],
};

// createJestConfig is exported in this way to ensure that next/jest can load the Next.js configuration, which is async
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatDateToMonthYear } from "./formatDateToMonthYear";
import { formatDateToMonthYear } from "../utils/formatDateToMonthYear";

describe("formatDateToMonthYear", () => {
it("should return the formatted dates correctly", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatOrdinal } from "./formatOrdinal";
import { formatOrdinal } from "../utils/formatOrdinal";

describe("formatOrdinal", () => {
it("should format basic ordinals correctly", () => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion utils/sortDates.test.ts → tests/sortDates.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sortAscendingDates, sortDescendingDates } from "./sortDates";
import { sortAscendingDates, sortDescendingDates } from "../utils/sortDates";

describe("sortDates", () => {
const testDates = [
Expand Down

0 comments on commit 6fc1dfb

Please sign in to comment.