Archived
1
0

fixup: formatting

This commit is contained in:
Joe Previte 2022-12-21 12:18:38 -07:00
parent 0fabb3a81d
commit cbf00ae7aa
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24

View File

@ -17,7 +17,7 @@ describe("VS Code Routes", ["--disable-workspace-trust"], {}, async () => {
const url = new URL(codeServerPage.page.url()) const url = new URL(codeServerPage.page.url())
expect(url.pathname).toBe(route) expect(url.pathname).toBe(route)
// TODO@jsjoeio // TODO@jsjoeio
// now that we are in a proper browser instead of scraping the HTML we // now that we are in a proper browser instead of scraping the HTML we
// could possibly intercept requests to make sure assets are loading from // could possibly intercept requests to make sure assets are loading from
// the right spot. // the right spot.
@ -73,43 +73,33 @@ describe(
}, },
) )
describe( describe("VS Code Routes with no workspace or folder", ["--disable-workspace-trust"], {}, async () => {
"VS Code Routes with no workspace or folder", test("should redirect to last query folder/workspace", async ({ codeServerPage }) => {
["--disable-workspace-trust"], const folder = process.env.CODE_FOLDER_DIR
{}, const workspace = process.env.CODE_WORKSPACE_DIR
async () => { await codeServerPage.navigate(`/?folder=${folder}&workspace=${workspace}`)
test("should redirect to last query folder/workspace", async ({ codeServerPage }) => {
const folder = process.env.CODE_FOLDER_DIR
const workspace = process.env.CODE_WORKSPACE_DIR
await codeServerPage.navigate(`/?folder=${folder}&workspace=${workspace}`)
// If you visit again without query parameters it will re-attach them by // If you visit again without query parameters it will re-attach them by
// redirecting. It should always redirect to the same route. // redirecting. It should always redirect to the same route.
for (const route of routes) { for (const route of routes) {
await codeServerPage.navigate(route) await codeServerPage.navigate(route)
const url = new URL(codeServerPage.page.url()) const url = new URL(codeServerPage.page.url())
expect(url.pathname).toBe(route) expect(url.pathname).toBe(route)
expect(url.search).toBe(`?folder=${folder}&workspace=${workspace}`) expect(url.search).toBe(`?folder=${folder}&workspace=${workspace}`)
} }
}) })
}, })
)
describe( describe("VS Code Routes with no workspace or folder", ["--disable-workspace-trust"], {}, async () => {
"VS Code Routes with no workspace or folder", test("should not redirect if ew passed in", async ({ codeServerPage }) => {
["--disable-workspace-trust"], const folder = process.env.CODE_FOLDER_DIR
{}, const workspace = process.env.CODE_WORKSPACE_DIR
async () => { await codeServerPage.navigate(`/?folder=${folder}&workspace=${workspace}`)
test("should not redirect if ew passed in", async ({ codeServerPage }) => {
const folder = process.env.CODE_FOLDER_DIR
const workspace = process.env.CODE_WORKSPACE_DIR
await codeServerPage.navigate(`/?folder=${folder}&workspace=${workspace}`)
// Closing the folder should stop the redirecting. // Closing the folder should stop the redirecting.
await codeServerPage.navigate("/?ew=true") await codeServerPage.navigate("/?ew=true")
let url = new URL(codeServerPage.page.url()) let url = new URL(codeServerPage.page.url())
expect(url.pathname).toBe("/") expect(url.pathname).toBe("/")
expect(url.search).toBe("?ew=true") expect(url.search).toBe("?ew=true")
}) })
}, })
)