Tests + Packages + Vite

This commit is contained in:
Dave
2026-03-16 11:02:48 -04:00
parent af52c35013
commit 3d7f2961fd
11 changed files with 2312 additions and 4013 deletions

3713
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,60 +2,60 @@
"name": "bodyshop",
"version": "0.2.1",
"engines": {
"node": ">=22.0.0"
"node": ">=22.12.0"
},
"type": "module",
"private": true,
"proxy": "http://localhost:4000",
"dependencies": {
"@amplitude/analytics-browser": "^2.35.3",
"@amplitude/analytics-browser": "^2.36.5",
"@ant-design/pro-layout": "^7.22.6",
"@apollo/client": "^4.1.6",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/modifiers": "^9.0.0",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@documenso/embed-react": "^0.5.1",
"@documenso/embed-react": "^0.6.0",
"@emotion/is-prop-valid": "^1.4.0",
"@fingerprintjs/fingerprintjs": "^5.0.1",
"@firebase/analytics": "^0.10.19",
"@firebase/app": "^0.14.8",
"@firebase/auth": "^1.12.0",
"@firebase/firestore": "^4.11.0",
"@firebase/messaging": "^0.12.22",
"@fingerprintjs/fingerprintjs": "^5.1.0",
"@firebase/analytics": "^0.10.20",
"@firebase/app": "^0.14.9",
"@firebase/auth": "^1.12.1",
"@firebase/firestore": "^4.12.0",
"@firebase/messaging": "^0.12.24",
"@jsreport/browser-client": "^3.1.0",
"@reduxjs/toolkit": "^2.11.2",
"@sentry/cli": "^3.2.2",
"@sentry/react": "^10.40.0",
"@sentry/cli": "^3.3.3",
"@sentry/react": "^10.43.0",
"@sentry/vite-plugin": "^4.9.1",
"@splitsoftware/splitio-react": "^2.6.1",
"@tanem/react-nprogress": "^5.0.63",
"antd": "^6.3.1",
"antd": "^6.3.3",
"apollo-link-logger": "^3.0.0",
"autosize": "^6.0.1",
"axios": "^1.13.5",
"axios": "^1.13.6",
"classnames": "^2.5.1",
"css-box-model": "^1.2.1",
"dayjs": "^1.11.19",
"dayjs": "^1.11.20",
"dayjs-business-days2": "^1.3.2",
"dinero.js": "^1.9.1",
"dotenv": "^17.3.1",
"env-cmd": "^11.0.0",
"exifr": "^7.1.3",
"graphql": "^16.13.0",
"graphql": "^16.13.1",
"graphql-ws": "^6.0.7",
"i18next": "^25.8.13",
"i18next": "^25.8.18",
"i18next-browser-languagedetector": "^8.2.1",
"immutability-helper": "^3.1.1",
"libphonenumber-js": "^1.12.38",
"lightningcss": "^1.31.1",
"logrocket": "^12.0.0",
"libphonenumber-js": "^1.12.40",
"lightningcss": "^1.32.0",
"logrocket": "^12.1.0",
"markerjs2": "^2.32.7",
"memoize-one": "^6.0.0",
"normalize-url": "^8.1.1",
"object-hash": "^3.0.0",
"phone": "^3.1.71",
"posthog-js": "^1.355.0",
"posthog-js": "^1.360.2",
"prop-types": "^15.8.1",
"query-string": "^9.3.1",
"raf-schd": "^4.0.3",
@@ -66,8 +66,8 @@
"react-dom": "^19.2.4",
"react-grid-gallery": "^1.0.1",
"react-grid-layout": "^2.2.2",
"react-i18next": "^16.5.4",
"react-icons": "^5.5.0",
"react-i18next": "^16.5.8",
"react-icons": "^5.6.0",
"react-image-lightbox": "^5.1.4",
"react-markdown": "^10.1.0",
"react-number-format": "^5.4.3",
@@ -77,8 +77,8 @@
"react-resizable": "^3.1.3",
"react-router-dom": "^7.13.1",
"react-sticky": "^6.0.3",
"react-virtuoso": "^4.18.1",
"recharts": "^3.7.0",
"react-virtuoso": "^4.18.3",
"recharts": "^3.8.0",
"redux": "^5.0.1",
"redux-actions": "^3.0.3",
"redux-persist": "^6.0.0",
@@ -86,7 +86,7 @@
"redux-state-sync": "^3.1.4",
"reselect": "^5.1.1",
"rxjs": "^7.8.2",
"sass": "^1.97.3",
"sass": "^1.98.0",
"socket.io-client": "^4.8.3",
"styled-components": "^6.3.11",
"vite-plugin-ejs": "^1.7.0",
@@ -141,15 +141,16 @@
"@ant-design/icons": "^6.1.0",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-react": "^7.28.5",
"@dotenvx/dotenvx": "^1.52.0",
"@dotenvx/dotenvx": "^1.55.1",
"@emotion/babel-plugin": "^11.13.5",
"@emotion/react": "^11.14.0",
"@eslint/js": "^9.39.2",
"@playwright/test": "^1.58.2",
"@rolldown/plugin-babel": "^0.2.1",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@vitejs/plugin-react": "^5.1.4",
"@vitejs/plugin-react": "^6.0.1",
"babel-plugin-react-compiler": "^1.0.0",
"browserslist": "^4.28.1",
"browserslist-to-esbuild": "^2.1.1",
@@ -157,21 +158,18 @@
"eslint": "^9.39.2",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
"globals": "^17.3.0",
"globals": "^17.4.0",
"jsdom": "^28.1.0",
"memfs": "^4.56.10",
"memfs": "^4.56.11",
"os-browserify": "^0.3.0",
"playwright": "^1.58.2",
"react-error-overlay": "^6.1.0",
"redux-logger": "^3.0.6",
"source-map-explorer": "^2.5.3",
"vite": "^7.3.1",
"vite-plugin-babel": "^1.5.1",
"vite": "^8.0.0",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-node-polyfills": "^0.25.0",
"vite-plugin-pwa": "^1.2.0",
"vite-plugin-style-import": "^2.0.0",
"vitest": "^4.0.18",
"vitest": "^4.1.0",
"workbox-window": "^7.4.0"
}
}

View File

@@ -1,6 +1,6 @@
import { combineReducers } from "redux";
import { persistReducer } from "redux-persist";
import storage from "redux-persist/lib/storage";
import storageModule from "redux-persist/lib/storage";
import { withReduxStateSync } from "redux-state-sync";
import applicationReducer from "./application/application.reducer";
import emailReducer from "./email/email.reducer";
@@ -11,6 +11,8 @@ import techReducer from "./tech/tech.reducer";
import userReducer from "./user/user.reducer";
import trelloReducer from "./trello/trello.reducer";
const storage = storageModule?.default ?? storageModule;
// const persistConfig = {
// key: "root",
// storage,

View File

@@ -5,13 +5,15 @@ import { RetryLink } from "@apollo/client/link/retry";
import { GraphQLWsLink } from "@apollo/client/link/subscriptions";
import { getMainDefinition } from "@apollo/client/utilities";
import apolloLogger from "apollo-link-logger";
import apolloLoggerModule from "apollo-link-logger";
import { createClient } from "graphql-ws";
import { map } from "rxjs/operators";
import { auth } from "../firebase/firebase.utils";
import errorLink from "../graphql/apollo-error-handling";
const apolloLogger = apolloLoggerModule?.default ?? apolloLoggerModule;
/**
* HTTP transport
*/

View File

@@ -47,6 +47,33 @@ const httpsCerts = {
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const pathSeparatorPattern = String.raw`[\\/]`;
const escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const packageChunkTest = (packageNames) => {
const names = Array.isArray(packageNames) ? packageNames : [packageNames];
return new RegExp(
`${pathSeparatorPattern}node_modules${pathSeparatorPattern}(?:${names
.map((name) => name.split("/").map(escapeRegex).join(pathSeparatorPattern))
.join("|")})(?:${pathSeparatorPattern}|$)`
);
};
const vendorCodeSplittingGroups = [
{ name: "antd", test: packageChunkTest("antd"), priority: 100 },
{ name: "react-redux", test: packageChunkTest("react-redux"), priority: 95 },
{ name: "redux", test: packageChunkTest("redux"), priority: 90 },
{ name: "lodash", test: packageChunkTest("lodash"), priority: 85 },
{ name: "@sentry/react", test: packageChunkTest("@sentry/react"), priority: 80 },
{ name: "@splitsoftware/splitio-react", test: packageChunkTest("@splitsoftware/splitio-react"), priority: 75 },
{ name: "logrocket", test: packageChunkTest("logrocket"), priority: 70 },
{ name: "firebase", test: packageChunkTest("@firebase"), priority: 65 },
{ name: "markerjs2", test: packageChunkTest("markerjs2"), priority: 60 },
{ name: "@apollo/client", test: packageChunkTest("@apollo/client"), priority: 55 },
{ name: "libphonenumber-js", test: packageChunkTest("libphonenumber-js"), priority: 50 },
{ name: "recharts", test: packageChunkTest("recharts"), priority: 45 }
];
export default defineConfig(({ command, mode }) => {
// React Compiler is always enabled for production/test builds
@@ -228,27 +255,13 @@ export default defineConfig(({ command, mode }) => {
build: {
sourcemap: true,
rollupOptions: {
rolldownOptions: {
output: {
manualChunks: {
antd: ["antd"],
"react-redux": ["react-redux"],
redux: ["redux"],
lodash: ["lodash"],
"@sentry/react": ["@sentry/react"],
"@splitsoftware/splitio-react": ["@splitsoftware/splitio-react"],
logrocket: ["logrocket"],
firebase: [
"@firebase/analytics",
"@firebase/app",
"@firebase/firestore",
"@firebase/auth",
"@firebase/messaging"
],
markerjs2: ["markerjs2"],
"@apollo/client": ["@apollo/client"],
"libphonenumber-js": ["libphonenumber-js"],
recharts: ["recharts"]
codeSplitting: {
groups: vendorCodeSplittingGroups
},
comments: {
legal: false
}
}
},
@@ -256,12 +269,6 @@ export default defineConfig(({ command, mode }) => {
cssMinify: "lightningcss"
},
// Strip console/debugger in prod to shrink bundles
esbuild: {
// drop: mode === "production" ? ["console", "debugger"] : [],
legalComments: "none" // Remove license comments in production
},
optimizeDeps: {
include: [
"react",
@@ -284,8 +291,8 @@ export default defineConfig(({ command, mode }) => {
"@firebase/util",
"styled-components"
],
esbuildOptions: {
loader: { ".jsx": "jsx", ".tsx": "tsx" }
rolldownOptions: {
moduleTypes: { ".jsx": "jsx", ".tsx": "tsx" }
},
// Force styled-components to be pre-bundled and deduplicated
force: mode === "development"

2394
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -18,16 +18,16 @@
"job-totals-fixtures:local": "docker exec node-app /usr/bin/node /app/download-job-totals-fixtures.js"
},
"dependencies": {
"@aws-sdk/client-cloudwatch-logs": "^3.997.0",
"@aws-sdk/client-elasticache": "^3.997.0",
"@aws-sdk/client-s3": "^3.997.0",
"@aws-sdk/client-secrets-manager": "^3.997.0",
"@aws-sdk/client-ses": "^3.997.0",
"@aws-sdk/client-sqs": "^3.997.0",
"@aws-sdk/client-textract": "^3.997.0",
"@aws-sdk/credential-provider-node": "^3.972.12",
"@aws-sdk/lib-storage": "^3.997.0",
"@aws-sdk/s3-request-presigner": "^3.997.0",
"@aws-sdk/client-cloudwatch-logs": "^3.1009.0",
"@aws-sdk/client-elasticache": "^3.1009.0",
"@aws-sdk/client-s3": "^3.1009.0",
"@aws-sdk/client-secrets-manager": "^3.1009.0",
"@aws-sdk/client-ses": "^3.1009.0",
"@aws-sdk/client-sqs": "^3.1009.0",
"@aws-sdk/client-textract": "^3.1009.0",
"@aws-sdk/credential-provider-node": "^3.972.21",
"@aws-sdk/lib-storage": "^3.1009.0",
"@aws-sdk/s3-request-presigner": "^3.1009.0",
"@documenso/sdk-typescript": "^0.8.0",
"@jsreport/nodejs-client": "^4.1.0",
"@opensearch-project/opensearch": "^2.13.0",
@@ -35,10 +35,10 @@
"@socket.io/redis-adapter": "^8.3.0",
"archiver": "^7.0.1",
"aws4": "^1.13.2",
"axios": "^1.13.5",
"axios": "^1.13.6",
"axios-curlirize": "^2.0.0",
"better-queue": "^3.8.12",
"bullmq": "^5.70.1",
"bullmq": "^5.71.0",
"chart.js": "^4.5.1",
"cloudinary": "^2.9.0",
"compression": "^1.8.1",
@@ -48,20 +48,20 @@
"dinero.js": "^1.9.1",
"dotenv": "^17.3.1",
"express": "^4.21.1",
"fast-xml-parser": "^5.4.1",
"firebase-admin": "^13.6.1",
"fast-xml-parser": "^5.5.6",
"firebase-admin": "^13.7.0",
"fuse.js": "^7.1.0",
"graphql": "^16.13.0",
"graphql": "^16.13.1",
"graphql-request": "^6.1.0",
"intuit-oauth": "^4.2.2",
"ioredis": "^5.9.3",
"ioredis": "^5.10.0",
"json-2-csv": "^5.5.10",
"jsonwebtoken": "^9.0.3",
"juice": "^11.1.1",
"lodash": "^4.17.23",
"moment": "^2.30.1",
"moment-timezone": "^0.6.0",
"multer": "^2.0.2",
"multer": "^2.1.1",
"mustache": "^4.2.0",
"node-persist": "^4.0.4",
"nodemailer": "^6.10.0",
@@ -71,15 +71,15 @@
"recursive-diff": "^1.0.9",
"rimraf": "^6.1.3",
"skia-canvas": "^3.0.8",
"soap": "^1.7.1",
"soap": "^1.8.0",
"socket.io": "^4.8.3",
"socket.io-adapter": "^2.5.6",
"ssh2-sftp-client": "^11.0.0",
"twilio": "^5.12.2",
"twilio": "^5.13.0",
"uuid": "^11.1.0",
"winston": "^3.19.0",
"winston-cloudwatch": "^6.3.0",
"xml-formatter": "^3.6.7",
"xml-formatter": "^3.7.0",
"xml2js": "^0.6.2",
"xmlbuilder2": "^4.0.3",
"yazl": "^3.3.1"
@@ -88,11 +88,11 @@
"@eslint/js": "^9.39.2",
"eslint": "^9.39.2",
"eslint-plugin-react": "^7.37.5",
"globals": "^17.3.0",
"globals": "^17.4.0",
"mock-require": "^3.0.3",
"p-limit": "^3.1.0",
"prettier": "^3.8.1",
"supertest": "^7.2.2",
"vitest": "^4.0.18"
"vitest": "^4.1.0"
}
}

View File

@@ -1,7 +1,7 @@
const sendPaymentNotificationEmail = require("./sendPaymentNotificationEmail");
const { INSERT_NEW_PAYMENT, GET_BODYSHOP_BY_ID, GET_JOBS_BY_PKS } = require("../../graphql-client/queries");
const getPaymentType = require("./getPaymentType");
const moment = require("moment");
const moment = require("moment-timezone");
const gqlClient = require("../../graphql-client/graphql-client").client;

View File

@@ -8,7 +8,7 @@ const {
const { sendTaskEmail } = require("../../email/sendemail");
const getPaymentType = require("./getPaymentType");
const moment = require("moment");
const moment = require("moment-timezone");
const gqlClient = require("../../graphql-client/graphql-client").client;

View File

@@ -1,5 +1,18 @@
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
const { mockSend } = vi.hoisted(() => ({
mockSend: vi.fn()
}));
vi.mock("@aws-sdk/client-secrets-manager", () => {
return {
SecretsManagerClient: vi.fn(() => ({
send: mockSend
})),
GetSecretValueCommand: vi.fn((input) => input)
};
});
const getPaymentType = require("../getPaymentType");
const decodeComment = require("../decodeComment");
const getCptellerUrl = require("../getCptellerUrl");
@@ -145,28 +158,15 @@ describe("Payment Processing Functions", () => {
// GetShopCredentials Tests
describe("getShopCredentials", () => {
const originalEnv = { ...process.env };
let mockSend;
beforeEach(() => {
mockSend = vi.fn();
vi.mock("@aws-sdk/client-secrets-manager", () => {
return {
SecretsManagerClient: vi.fn(() => ({
send: mockSend
})),
GetSecretValueCommand: vi.fn((input) => input)
};
});
mockSend.mockReset();
process.env.INTELLIPAY_MERCHANTKEY = "test-merchant-key";
process.env.INTELLIPAY_APIKEY = "test-api-key";
vi.resetModules();
});
afterEach(() => {
process.env = { ...originalEnv };
vi.restoreAllMocks();
vi.unmock("@aws-sdk/client-secrets-manager");
});
it("returns environment variables in non-production environment", async () => {

View File

@@ -35,6 +35,11 @@ describe("TotalsServerSide fixture tests", () => {
const fixtureFiles = fs.readdirSync(fixturesDir).filter((f) => f.endsWith(".json"));
if (fixtureFiles.length === 0) {
it.skip("skips when no job total fixtures are present", () => {});
return;
}
const dummyClient = {
request: async () => {
return {};