- Notifications
You must be signed in to change notification settings - Fork928
chore: updated documentation link#1387
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -11,6 +11,18 @@ const renderAndClick = async (props: Partial<UserDropdownProps> = {}) => { | ||
} | ||
describe("UserDropdown", () => { | ||
const env = process.env | ||
// REMARK: copying process.env so we don't mutate that object or encounter conflicts between tests | ||
beforeEach(() => { | ||
process.env = { ...env } | ||
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. Since env is already receiving the process.env in line 14, I would guess we are doing this to clone the object, is that right? 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. That's right - I don't want to mutate 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. If makes sense, I just would add a comment about this. | ||
}) | ||
// REMARK: restoring process.env | ||
afterEach(() => { | ||
process.env = env | ||
}) | ||
describe("when the trigger is clicked", () => { | ||
it("opens the menu", async () => { | ||
await renderAndClick() | ||
@@ -32,14 +44,15 @@ describe("UserDropdown", () => { | ||
}) | ||
it("has the correct link for the documentation item", async () => { | ||
process.env.CODER_VERSION = "v0.5.4" | ||
await renderAndClick() | ||
const link = screen.getByText(Language.docsLabel).closest("a") | ||
if (!link) { | ||
throw new Error("Anchor tag not found for the documentation menu item") | ||
} | ||
expect(link.getAttribute("href")).toBe(`https://github.com/coder/coder/tree/${process.env.CODER_VERSION}/docs`) | ||
}) | ||
it("has the correct link for the account item", async () => { | ||