(
str,
{ owner, repo, token, forkOwner, forkToken, ownerName, forkOwnerName },
)
| 278 | } |
| 279 | |
| 280 | const sanitizeString = ( |
| 281 | str, |
| 282 | { owner, repo, token, forkOwner, forkToken, ownerName, forkOwnerName }, |
| 283 | ) => { |
| 284 | let replaced = str |
| 285 | .replace(new RegExp(escapeRegExp(forkOwner), 'g'), GITHUB_OPEN_AUTHORING_OWNER_SANITIZED_VALUE) |
| 286 | .replace(new RegExp(escapeRegExp(forkToken), 'g'), GITHUB_OPEN_AUTHORING_TOKEN_SANITIZED_VALUE) |
| 287 | .replace(new RegExp(escapeRegExp(owner), 'g'), GITHUB_REPO_OWNER_SANITIZED_VALUE) |
| 288 | .replace(new RegExp(escapeRegExp(repo), 'g'), GITHUB_REPO_NAME_SANITIZED_VALUE) |
| 289 | .replace(new RegExp(escapeRegExp(token), 'g'), GITHUB_REPO_TOKEN_SANITIZED_VALUE) |
| 290 | .replace( |
| 291 | new RegExp('https://avatars\\d+\\.githubusercontent\\.com/u/\\d+?\\?v=\\d', 'g'), |
| 292 | `${FAKE_OWNER_USER.avatar_url}`, |
| 293 | ); |
| 294 | |
| 295 | if (ownerName) { |
| 296 | replaced = replaced.replace(new RegExp(escapeRegExp(ownerName), 'g'), FAKE_OWNER_USER.name); |
| 297 | } |
| 298 | |
| 299 | if (forkOwnerName) { |
| 300 | replaced = replaced.replace( |
| 301 | new RegExp(escapeRegExp(forkOwnerName), 'g'), |
| 302 | FAKE_FORK_OWNER_USER.name, |
| 303 | ); |
| 304 | } |
| 305 | |
| 306 | return replaced; |
| 307 | }; |
| 308 | |
| 309 | const transformRecordedData = (expectation, toSanitize) => { |
| 310 | const requestBodySanitizer = httpRequest => { |
no test coverage detected