mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: updated documentation link (#1387)
* chore: updated documentation link * PR feedback
This commit is contained in:
@@ -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 }
|
||||
})
|
||||
|
||||
// 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 () => {
|
||||
|
||||
@@ -77,7 +77,12 @@ export const UserDropdown: React.FC<UserDropdownProps> = ({ user, onSignOut }: U
|
||||
</MenuItem>
|
||||
</Link>
|
||||
|
||||
<a href="https://coder.com/docs" target="_blank" rel="noreferrer" className={styles.link}>
|
||||
<a
|
||||
href={`https://github.com/coder/coder/tree/${process.env.CODER_VERSION}/docs`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className={styles.link}
|
||||
>
|
||||
<MenuItem className={styles.menuItem} onClick={onPopoverClose}>
|
||||
<ListItemIcon className={styles.icon}>
|
||||
<DocsIcon />
|
||||
|
||||
@@ -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 || ""}'`)
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user