Skip to content

Commit fa06d2e

Browse files
stabilize snapshot
1 parent b33ff91 commit fa06d2e

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

tests/tools/network.test.js.snapshot

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Status: [success - 200]
55
### Request Headers
66
- accept-language:en-US,en;q=0.9
77
- upgrade-insecure-requests:1
8-
- user-agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/141.0.0.0 Safari/537.36
9-
- sec-ch-ua:"Chromium";v="141", "Not?A_Brand";v="8"
8+
- user-agent:<user-agent>
9+
- sec-ch-ua:"Chromium";v="<version>", "Not?A_Brand";v="8"
1010
- sec-ch-ua-mobile:?0
11-
- sec-ch-ua-platform:"Linux"
11+
- sec-ch-ua-platform:"<os>"
1212
### Response Headers
1313
- connection:keep-alive
1414
- content-length:239

tests/utils.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,19 @@ export function stabilizeResponseOutput(text: unknown) {
137137
}
138138
let output = text;
139139
const dateRegEx = /.{3}, \d{2} .{3} \d{4} \d{2}:\d{2}:\d{2} [A-Z]{3}/g;
140-
const localhostRegEx = /http:\/\/localhost:\d{5}\//g;
141140
output = output.replaceAll(dateRegEx, '<long date>');
141+
142+
const localhostRegEx = /http:\/\/localhost:\d{5}\//g;
142143
output = output.replaceAll(localhostRegEx, 'http://localhost:<port>/');
144+
145+
const userAgentRegEx = /user-agent:.*\n/g;
146+
output = output.replaceAll(userAgentRegEx, 'user-agent:<user-agent>\n');
147+
148+
const chUaRegEx = /sec-ch-ua:"Chromium";v="\d{3}"/g;
149+
output = output.replaceAll(chUaRegEx, 'sec-ch-ua:"Chromium";v="<version>"');
150+
151+
// sec-ch-ua-platform:"Linux"
152+
const chUaPlatformRegEx = /sec-ch-ua-platform:"[a-zA-Z]*"/g;
153+
output = output.replaceAll(chUaPlatformRegEx, 'sec-ch-ua-platform:"<os>"');
143154
return output;
144155
}

0 commit comments

Comments
 (0)