-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: [#188079116] Show the License Status Check in Renewal Events #8551
Open
cbrunefearless
wants to merge
1
commit into
main
Choose a base branch
from
cbrune/renewalEvents
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
8 changes: 4 additions & 4 deletions
8
...nses/health-care-services-firm-renewal.md → ...wals/health-care-services-firm-renewal.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
content/src/fieldConfig/anytime-action-renewals-defaults.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"anytimeActionRenewalsDefaults": { | ||
"LicenseDefaultText": "You can renew your license 60 days before it expires and up to 30 days after expiration. If you fail to renew your license at this point, your license will be suspended and you won't be able to provide your licensed services", | ||
"licenseExpirationHeaderText": "EXPIRATION DATE:", | ||
"licenseStatusHeaderText": "Current Status", | ||
"licenseLastUpdatedText": "Last Updated:", | ||
"licenseDefaultText": "You can renew your license 60 days before it expires and up to 30 days after expiration. If you fail to renew your license at this point, your license will be suspended and you won't be able to provide your licensed services" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
179 changes: 179 additions & 0 deletions
179
web/src/components/tasks/anytime-action/AnytimeActionLicenseRenewalElement.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
import { AnytimeActionLicenseRenewalElement } from "@/components/tasks/anytime-action/AnytimeActionLicenseRenewalElement"; | ||
import { getMergedConfig } from "@/contexts/configContext"; | ||
import { AnytimeActionLicenseRenewal } from "@/lib/types/types"; | ||
import { generateAnytimeActionLicenseRenewal } from "@/test/factories"; | ||
import { useMockBusiness } from "@/test/mock/mockUseUserData"; | ||
import { | ||
defaultDateFormat, | ||
licenseSearchDateFormat, | ||
parseDateWithFormat, | ||
} from "@businessnjgovnavigator/shared/"; | ||
import { randomElementFromArray } from "@businessnjgovnavigator/shared/arrayHelpers"; | ||
import { taskIdLicenseNameMapping } from "@businessnjgovnavigator/shared/license"; | ||
import { generateLicenseData, generateLicenseDetails } from "@businessnjgovnavigator/shared/test"; | ||
import { fireEvent, render, screen } from "@testing-library/react"; | ||
|
||
jest.mock("@/lib/data-hooks/useUserData", () => ({ useUserData: jest.fn() })); | ||
const Config = getMergedConfig(); | ||
|
||
describe("<AnytimeActionLicenseRenewalElement />", () => { | ||
beforeEach(() => { | ||
jest.resetAllMocks(); | ||
useMockBusiness({}); | ||
}); | ||
|
||
const renderAnytimeActionLicenseRenewalElement = (overrides?: AnytimeActionLicenseRenewal): void => { | ||
const anytimeActionLicenseRenewalElement = generateAnytimeActionLicenseRenewal({ | ||
...overrides, | ||
}); | ||
render( | ||
<AnytimeActionLicenseRenewalElement anytimeActionLicenseRenewal={anytimeActionLicenseRenewalElement} /> | ||
); | ||
}; | ||
|
||
it("renders Anytime Action License Renewal Element with Active status", () => { | ||
const licenseName = randomElementFromArray(Object.values(taskIdLicenseNameMapping)); | ||
|
||
useMockBusiness({ | ||
licenseData: generateLicenseData({ | ||
licenses: { | ||
[licenseName]: generateLicenseDetails({ | ||
licenseStatus: "ACTIVE", | ||
}), | ||
}, | ||
}), | ||
}); | ||
|
||
const anytimeActionLicense = [ | ||
generateAnytimeActionLicenseRenewal({ | ||
name: "some-license-name", | ||
urlSlug: "some-url", | ||
filename: "some-filename-license", | ||
licenseName, | ||
}), | ||
]; | ||
renderAnytimeActionLicenseRenewalElement(anytimeActionLicense[0]); | ||
expect(screen.getByTestId("permit-ACTIVE")).toBeInTheDocument(); | ||
}); | ||
|
||
it("renders Anytime Action License Renewal Element with company name and address", () => { | ||
const licenseName = randomElementFromArray(Object.values(taskIdLicenseNameMapping)); | ||
const licenseAddress = { | ||
name: "Business Sample", | ||
addressLine1: "1 Business Way", | ||
addressLine2: "Suite 10", | ||
zipCode: "08211", | ||
}; | ||
|
||
useMockBusiness({ | ||
licenseData: generateLicenseData({ | ||
licenses: { | ||
[licenseName]: generateLicenseDetails({ | ||
licenseStatus: "ACTIVE", | ||
nameAndAddress: { | ||
...licenseAddress, | ||
}, | ||
}), | ||
}, | ||
}), | ||
}); | ||
|
||
const anytimeActionLicense = [ | ||
generateAnytimeActionLicenseRenewal({ | ||
name: "some-license-name", | ||
urlSlug: "some-url", | ||
filename: "some-filename-license", | ||
licenseName, | ||
}), | ||
]; | ||
const secondLineAddress = licenseAddress.addressLine2 ? ` ${licenseAddress.addressLine2}` : ""; | ||
const address = | ||
`${licenseAddress.addressLine1}${secondLineAddress}, ${licenseAddress.zipCode} NJ`.toUpperCase(); | ||
renderAnytimeActionLicenseRenewalElement(anytimeActionLicense[0]); | ||
expect(screen.getByText(licenseAddress.name.toUpperCase())).toBeInTheDocument(); | ||
expect(screen.getByText(address)).toBeInTheDocument(); | ||
}); | ||
|
||
it("renders Anytime Action License RenewalElement with last updated date", () => { | ||
const licenseName = randomElementFromArray(Object.values(taskIdLicenseNameMapping)); | ||
const licenseAddress = { | ||
name: "Business Sample", | ||
addressLine1: "1 Business Way", | ||
addressLine2: "Suite 10", | ||
zipCode: "08211", | ||
}; | ||
|
||
useMockBusiness({ | ||
licenseData: generateLicenseData({ | ||
licenses: { | ||
[licenseName]: generateLicenseDetails({ | ||
licenseStatus: "ACTIVE", | ||
nameAndAddress: { | ||
...licenseAddress, | ||
}, | ||
lastUpdatedISO: "2018-04-23T10:26:00.996Z", | ||
}), | ||
}, | ||
}), | ||
}); | ||
|
||
const anytimeActionLicense = [ | ||
generateAnytimeActionLicenseRenewal({ | ||
name: "some-license-name", | ||
urlSlug: "some-url", | ||
filename: "some-filename-license", | ||
licenseName, | ||
}), | ||
]; | ||
|
||
renderAnytimeActionLicenseRenewalElement(anytimeActionLicense[0]); | ||
expect( | ||
screen.getByText( | ||
parseDateWithFormat("2018-04-23T10:26:00.996Z", defaultDateFormat).format(licenseSearchDateFormat) | ||
) | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
it("renders Anytime Action License Renewal Element with checklist items", () => { | ||
const licenseName = randomElementFromArray(Object.values(taskIdLicenseNameMapping)); | ||
const licenseAddress = { | ||
name: "Business Sample", | ||
addressLine1: "1 Business Way", | ||
addressLine2: "Suite 10", | ||
zipCode: "08211", | ||
}; | ||
|
||
useMockBusiness({ | ||
licenseData: generateLicenseData({ | ||
licenses: { | ||
[licenseName]: generateLicenseDetails({ | ||
licenseStatus: "ACTIVE", | ||
nameAndAddress: { | ||
...licenseAddress, | ||
}, | ||
checklistItems: [{ title: `checklist-title-1`, status: "ACTIVE" }], | ||
lastUpdatedISO: "2018-04-23T10:26:00.996Z", | ||
}), | ||
}, | ||
}), | ||
}); | ||
|
||
const anytimeActionLicense = [ | ||
generateAnytimeActionLicenseRenewal({ | ||
name: "some-license-name", | ||
urlSlug: "some-url", | ||
filename: "some-filename-license", | ||
licenseName, | ||
}), | ||
]; | ||
|
||
renderAnytimeActionLicenseRenewalElement(anytimeActionLicense[0]); | ||
const applicationCheckListItems = screen.getByText( | ||
Config.licenseSearchTask.applicationChecklistItemsText | ||
); | ||
|
||
expect(applicationCheckListItems).toBeInTheDocument(); | ||
fireEvent.click(applicationCheckListItems); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [sand] Hey just a heads up, we should probably be using |
||
expect(screen.getByText("checklist-title-1")).toBeInTheDocument(); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boulder: the goal of this ticket is to add the license status component to the
[licenseUrlSlug]
page. This page renders the content living withincontent/src/licenses
. The user is able to access the calendar license page by clicking the renewal/expiration link on the filings calendar. Alot of the existing functionality you added can be removed because it's already existing (i.e. mgmt/search, loading files, etc)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One approach is to add the existing component to the [licenseUrlSlug] page and create tests to validate the data renders. All the other logic is not necessary because it's working. You may want to refactor the content/src/licenses to something like content/src/licenseCalendarEvents so it's more clear.