MCPcopy Index your code
hub / github.com/coder/coder / toHavePathName

Function toHavePathName

site/e2e/expectUrl.ts:10–37  ·  view source on GitHub ↗

* toHavePathName is an alternative to `toHaveURL` that won't fail if the URL * contains query parameters.

(page: Page, expected: string, options?: PollingOptions)

Source from the content-addressed store, hash-verified

8 * contains query parameters.
9 */
10 async toHavePathName(page: Page, expected: string, options?: PollingOptions) {
11 let actual: string = new URL(page.url()).pathname;
12 let pass: boolean;
13 try {
14 await expect
15 .poll(() => {
16 actual = new URL(page.url()).pathname;
17 return actual;
18 }, options)
19 .toBe(expected);
20 pass = true;
21 } catch {
22 pass = false;
23 }
24
25 return {
26 name: "toHavePathName",
27 pass,
28 actual,
29 expected,
30 message: () =>
31 `The page does not have the expected URL pathname.\nExpected: ${
32 this.isNot ? "not" : ""
33 }${this.utils.printExpected(
34 expected,
35 )}\nActual: ${this.utils.printReceived(actual)}`,
36 };
37 },
38
39 /**
40 * toHavePathNameEndingWith allows checking the end of the URL (ie. to make

Callers

nothing calls this directly

Calls 2

urlMethod · 0.65
pollMethod · 0.45

Tested by

no test coverage detected