diff --git a/site/src/components/UserDropdown/UserDropdown.test.tsx b/site/src/components/UserDropdown/UserDropdown.test.tsx index c5261b1f0dcc4..880c9b0960402 100644 --- a/site/src/components/UserDropdown/UserDropdown.test.tsx +++ b/site/src/components/UserDropdown/UserDropdown.test.tsx @@ -11,6 +11,18 @@ const renderAndClick = async (props: Partial = {}) => { } 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 } + }) + + // REMARK: restoring process.env + afterEach(() => { + process.env = env + }) + describe("when the trigger is clicked", () => { it("opens the menu", async () => { await renderAndClick() @@ -32,6 +44,7 @@ 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") @@ -39,7 +52,7 @@ describe("UserDropdown", () => { throw new Error("Anchor tag not found for the documentation menu item") } - expect(link.getAttribute("href")).toBe("https://coder.com/docs") + 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 () => { diff --git a/site/src/components/UserDropdown/UsersDropdown.tsx b/site/src/components/UserDropdown/UsersDropdown.tsx index c7aa3ba49f47a..503f9517125b2 100644 --- a/site/src/components/UserDropdown/UsersDropdown.tsx +++ b/site/src/components/UserDropdown/UsersDropdown.tsx @@ -77,7 +77,12 @@ export const UserDropdown: React.FC = ({ user, onSignOut }: U - + diff --git a/site/webpack.common.ts b/site/webpack.common.ts index 18f8886db5737..aaf494b0e3efb 100644 --- a/site/webpack.common.ts +++ b/site/webpack.common.ts @@ -13,8 +13,10 @@ import { Configuration, EnvironmentPlugin } from "webpack" */ const environmentPlugin = new EnvironmentPlugin({ INSPECT_XSTATE: "", + CODER_VERSION: "main", }) console.info(`--- Setting INSPECT_XSTATE to '${process.env.INSPECT_XSTATE || ""}'`) +console.info(`--- Setting CODER_VERSION to '${process.env.CODER_VERSION || "main"}'`) console.info(`--- Setting NODE_ENV to '${process.env.NODE_ENV || ""}'`) /**