-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render React LOC content from session data. (#1535)
This builds upon #1534 by rendering the React version of the LOC content from the user's session data and exposing it at `/loc/react-letter.pdf` (the `react-` prefix means it won't conflict with the Django-based renderer, which is still what's used in production).
- Loading branch information
Showing
8 changed files
with
196 additions
and
22 deletions.
There are no files selected for viewing
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
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
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
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
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 |
---|---|---|
@@ -1,10 +1,31 @@ | ||
import React from "react"; | ||
import ReactTestingLibraryPal from "../../tests/rtl-pal"; | ||
import { LocContent, locSampleProps } from "../letter-content"; | ||
import { | ||
LocContent, | ||
locSampleProps, | ||
getLocContentPropsFromSession, | ||
} from "../letter-content"; | ||
import { newSb } from "../../tests/session-builder"; | ||
|
||
describe("<LocContent>", () => { | ||
it("works", () => { | ||
const pal = new ReactTestingLibraryPal(<LocContent {...locSampleProps} />); | ||
expect(pal.rr.container).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
const filledUser = newSb() | ||
.withLoggedInJustfixUser() | ||
.withLandlordDetails() | ||
.withCustomIssue() | ||
.withIssues(); | ||
|
||
describe("getLocContentPropsFromSession()", () => { | ||
it("returns null when user is logged out", () => { | ||
expect(getLocContentPropsFromSession(newSb().value)).toBe(null); | ||
}); | ||
|
||
it("returns expected value when user is logged in", () => { | ||
expect(getLocContentPropsFromSession(filledUser.value)).toMatchSnapshot(); | ||
}); | ||
}); |
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
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
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