Skip to content
3 changes: 3 additions & 0 deletions frontend/src/common/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ export const DEFAULT_EMPTY_SELECT_OPTION = {
export const DEFAULT_SELECT_OPTIONS = [DEFAULT_EMPTY_SELECT_OPTION];

export const EMPTY_VEHICLE_UNIT_NUMBER = DEFAULT_EMPTY_SELECT_VALUE;

//Inventory GVW
export const GVW_LIMIT = 63500;
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ import {
invalidPlateLength,
invalidVINLength,
invalidYearMin,
licensedGVWExceeded,
requiredMessage,
} from "../../../../common/helpers/validationMessages";
import { ORBC_FORM_FEATURES } from "../../../../common/types/common";
import { GVW_LIMIT } from "../../../../common/constants/constants";

const FEATURE = ORBC_FORM_FEATURES.POWER_UNIT;

Expand Down Expand Up @@ -258,6 +260,9 @@ export const PowerUnitForm = ({
required: { value: true, message: requiredMessage() },
validate: {
isNumber: (v) => !isNaN(v) || invalidNumber(),
lessThanMax: (v) =>
parseFloat(v) < GVW_LIMIT ||
licensedGVWExceeded(GVW_LIMIT, true),
},
},
inputType: "number",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@
}

// Assert - no errors shown after submission
expect(async () => await submitErrorsDisplay()).rejects.toThrow();
await expect(submitErrorsDisplay()).rejects.toThrow();

Check failure on line 53 in frontend/src/features/manageVehicles/components/form/tests/helpers/assert.ts

View workflow job for this annotation

GitHub Actions / Tests (frontend)

src/features/manageVehicles/components/form/tests/PowerUnitForm.test.tsx > Power Unit Form Submission > should successfully submit form without errors shown on ui

AssertionError: promise resolved "<p …(2)></p>" instead of rejecting - Expected + Received - [Error: rejected promise] + <p + class="MuiFormHelperText-root Mui-error MuiFormHelperText-sizeMedium MuiFormHelperText-contained Mui-focused MuiFormHelperText-filled custom-form-control__helper-text css-1wc848c-MuiFormHelperText-root" + data-testid="alert-licensedGvw" + > + Can't Exceed 63,500 + </p> ❯ Module.assertSuccessfulSubmit src/features/manageVehicles/components/form/tests/helpers/assert.ts:53:16 ❯ src/features/manageVehicles/components/form/tests/PowerUnitForm.test.tsx:159:5
};
Loading