Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OY2-30910 test updates #1548

Draft
wants to merge 13 commits into
base: ui-lib-update
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ jobs:
homePage,
faqPage,
manageProfilePage,
dashboardPage,
packagePageSpas,
packagePageWaivers,
RequestRoleChangePage,
Expand All @@ -458,6 +457,8 @@ jobs:
PackageWaiverAmendmentPage,
PackageInitialWaiverPage,
PackageWaiverRenewalPage,
SPAPackageDetailsPage,
WaiversPackageDetailsPage,
]
steps:
- name: set branch_name
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16.20.2
4 changes: 2 additions & 2 deletions services/app-api/seed-data/all-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -59411,7 +59411,7 @@
"submissionTimestamp": 1675108098000,
"submitterEmail": "[email protected]",
"submitterName": "Statesubmitter Nightwatch",
"temporaryExtensionType": "1915(b)",
"temporaryExtensionType": "1915(c)",
"territory": "MD",
"transmittalNumberWarningMessage": ""
},
Expand Down Expand Up @@ -59456,7 +59456,7 @@
"submissionTimestamp": 1675108098000,
"submitterEmail": "[email protected]",
"submitterName": "Statesubmitter Nightwatch",
"temporaryExtensionType": "1915(b)"
"temporaryExtensionType": "1915(c)"
},
{
"pk": "MD-5535.R00.TE01",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"submissionTimestamp": 1675108098000,
"submitterEmail": "[email protected]",
"submitterName": "Statesubmitter Nightwatch",
"temporaryExtensionType": "1915(b)",
"temporaryExtensionType": "1915(c)",
"territory": "MD",
"transmittalNumberWarningMessage": ""
},
Expand Down Expand Up @@ -71,6 +71,6 @@
"submissionTimestamp": 1675108098000,
"submitterEmail": "[email protected]",
"submitterName": "Statesubmitter Nightwatch",
"temporaryExtensionType": "1915(b)"
"temporaryExtensionType": "1915(c)"
}
]
1 change: 1 addition & 0 deletions services/ui-src/.env
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ S3_ATTACHMENTS_BUCKET_NAME=placeholder
ALLOW_DEV_LOGIN=placeholder
METRICS_USERS=placeholder
REACT_APP_GOOGLE_TAG=thisone
SKIP_PREFLIGHT_CHECK=true
12,087 changes: 5,891 additions & 6,196 deletions services/ui-src/package-lock.json

Large diffs are not rendered by default.

39 changes: 14 additions & 25 deletions services/ui-src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@
"description": "",
"version": "1.0.0",
"dependencies": {
"@babel/polyfill": "^7.12.1",
"@cmsgov/design-system": "^3.8.0",
"@cmsgov/design-system": "^11.0.1",
"@material-ui/core": "^4.11.3",
"@material-ui/data-grid": "^4.0.0-alpha.22",
"@react-spring/web": "^9.4.2",
"@testing-library/dom": "^7.9.0",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^13.0.0",
"aws-amplify": "^4.3.35",
"axios": "1.5.1",
"bootstrap": "^3.3.7",
"bootstrap": "^5.3.3",
"classnames": "^2.3.1",
"cmscommonlib": "file:../common",
"core-js": "^3.7.0",
Expand All @@ -25,21 +21,18 @@
"jwt-decode": "^3.1.2",
"launchdarkly-react-client-sdk": "^3.5.0",
"promise-polyfill": "8.3.0",
"react": "^16.13.1",
"react-bootstrap": "^0.33.1",
"react-collapsible": "^2.8.3",
"react": "^18.3.1",
"react-device-detect": "^1.14.0",
"react-dom": "^16.13.1",
"react-dom": "^18.3.1",
"react-idle-timer": "^5.4.1",
"react-ios-switch": "^0.1.19",
"react-phone-input-2": "^2.13.8",
"react-router-bootstrap": "^0.26.2",
"react-router-dom": "^5.1.2",
"react-router-hash-link": "^2.2.2",
"react-router-dom": "^5.3.4",
"react-scripts": "^5.0.1",
"react-table": "^7.7.0",
"sass": "^1.49.9"
},
"resolutions": {
"@types/react": "18.2.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build && node remove-versions.js",
Expand All @@ -65,25 +58,21 @@
]
},
"devDependencies": {
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.7",
"@babel/plugin-proposal-private-property-in-object": "^7.0.0",
"@babel/preset-env": "^7.12.1",
"@babel/plugin-proposal-private-property-in-object": "7.21.11",
"@fortawesome/fontawesome-svg-core": "^1.2.35",
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@fortawesome/react-fontawesome": "^0.1.14",
"@types/file-saver": "^2.0.5",
"@types/react-dom": "^17.0.9",
"@types/react-router-dom": "^5.1.8",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react-router-dom": "^5.1.2",
"@types/react-table": "^7.7.8",
"jest-when": "^3.3.1",
"ajv": "^8.17.1",
"react-select": "^5.2.2",
"react-select-event": "^5.3.0",
"rsuite": "^5.4.0",
"serverless-cloudfront-invalidate": "1.12.2",
"serverless-plugin-scripts": "^1.0.2",
"serverless-s3-sync": "^1.14.4",
"typescript": "^4.4.2"
"serverless-s3-sync": "^1.14.4"
},
"babel": {
"presets": [
Expand Down
19 changes: 8 additions & 11 deletions services/ui-src/remove-versions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const fs = require('fs');
const path = require('path');
const fs = require("fs");
const path = require("path");

// Define the directory of the build output
const buildDir = path.join(__dirname, 'build', 'static', 'js');
const buildDir = path.join(__dirname, "build", "static", "js");

// Function to remove the version from files
const removeVersionFromFiles = (dir) => {
Expand All @@ -12,12 +12,12 @@ const removeVersionFromFiles = (dir) => {
return;
}

files.forEach(file => {
files.forEach((file) => {
const filePath = path.join(dir, file);

// Check if the file is a JavaScript file
if (file.endsWith('.js')) {
fs.readFile(filePath, 'utf8', (err, data) => {
if (file.endsWith(".js")) {
fs.readFile(filePath, "utf8", (err, data) => {
if (err) {
console.error("Error reading file:", err);
return;
Expand All @@ -32,9 +32,9 @@ const removeVersionFromFiles = (dir) => {
} else {
console.log(`No version found in ${file}`);
}

// Write the modified content back to the file
fs.writeFile(filePath, result, 'utf8', (err) => {
fs.writeFile(filePath, result, "utf8", (err) => {
if (err) {
console.error("Error writing file:", err);
} else {
Expand All @@ -48,6 +48,3 @@ const removeVersionFromFiles = (dir) => {
};

removeVersionFromFiles(buildDir);



33 changes: 16 additions & 17 deletions services/ui-src/src/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,34 @@ import { MemoryRouter } from "react-router-dom";
import { Auth } from "aws-amplify";
import UserDataApi from "./utils/UserDataApi";
import IdleTimerWrapper from "./components/IdleTimerWrapper";
import NotificationsApi from './utils/NotificationApi';
import NotificationsApi from "./utils/NotificationApi";

import App from "./App";
import App from "./App";
import { RESPONSE_CODE } from "cmscommonlib";

jest.mock("aws-amplify");
jest.mock("./utils/UserDataApi");
jest.mock("./components/IdleTimerWrapper");

jest.mock('uuid', () => ({
v4: jest.fn(() => '1234-5678-9012-3456'), // Return a fixed UUID for testing
jest.mock("uuid", () => ({
v4: jest.fn(() => "1234-5678-9012-3456"), // Return a fixed UUID for testing
}));

// Mocking launchdarkly-react-client-sdk
jest.mock('launchdarkly-react-client-sdk', () => {
jest.mock("launchdarkly-react-client-sdk", () => {
return {
withLDProvider: () => (Component) => (props) => <Component {...props} />,
useFlags: jest.fn(), // This will be a mock function
};
});

jest.mock('./utils/NotificationApi', () => ({
jest.mock("./utils/NotificationApi", () => ({
createUserNotifications: jest.fn(),
dismissUserNotifications: jest.fn(),
getActiveSystemNotifications: jest.fn()
getActiveSystemNotifications: jest.fn(),
}));

const { useFlags } = require('launchdarkly-react-client-sdk');
const { useFlags } = require("launchdarkly-react-client-sdk");

beforeEach(() => {
// fixing the 'window.matchMedia is not defined' error
Expand Down Expand Up @@ -83,11 +83,11 @@ beforeEach(() => {

NotificationsApi.createUserNotifications.mockResolvedValue([
{
sk: 'notification-1',
header: 'Test Notification',
body: 'This is a test notification.',
buttonLink: '/some-link',
buttonText: 'Click here',
sk: "notification-1",
header: "Test Notification",
body: "This is a test notification.",
buttonLink: "/some-link",
buttonText: "Click here",
},
]);
});
Expand Down Expand Up @@ -130,7 +130,7 @@ describe("App Component", () => {
);
await act(async () => {});

const notificationBanner = screen.getByTestId('notification-alert'); // Assuming the NotificationBanner uses role="banner"
const notificationBanner = screen.getByTestId("notification-alert"); // Assuming the NotificationBanner uses role="banner"
expect(notificationBanner).toBeInTheDocument();
});

Expand All @@ -143,8 +143,7 @@ describe("App Component", () => {
);
await act(async () => {});

const notificationBanner = screen.queryByTestId('notification-alert'); // This checks for absence
const notificationBanner = screen.queryByTestId("notification-alert"); // This checks for absence
expect(notificationBanner).not.toBeInTheDocument(); // Expect it to not be in the document
});

});
});
Loading
Loading