Skip to content

Commit

Permalink
test: update snapshots and mock string cleaning for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Shuunen committed Dec 29, 2024
1 parent 9e2365d commit 4e19933
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/__snapshots__/check.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ exports[`check B repo-checker folder succeed 1`] = `
"package-json-main-file-maximum-size-is-specified-in-data-file-ex-max-size-ko-100",
"package-json-has-a-dist-repo-check-js-file",
"package-json-main-file-specified-in-package-json-dist-repo-check-js-exists-on-disk-be-sure-to-build-before-run-repo-check",
"package-json-main-file-size-60ko-should-be-less-or-equal-to-max-size-allowed-120ko",
"package-json-main-file-size-XYZko-should-be-less-or-equal-to-max-size-allowed-120ko",
"package-json-has-a-schema-declaration",
"package-json-has-a-bugs-property",
"package-json-has-a-description-property",
Expand Down
8 changes: 7 additions & 1 deletion src/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ const fileBaseKeysToDelete: (keyof FileBase)[] = ['fileExists', 'checkFileExists
const indicatorsKeys: ReadonlyArray<keyof Awaited<ReturnType<typeof check>>> = ['failed', 'passed', 'warnings'] as const

function cleanStringForSnap(input: string) {
return input.replace(/repo-check-\d-\d+/gu, 'repo-check-x-yy') // replace repo-check-1-40 by repo-check-x-yy
return (
input
// replace repo-check-1-40 by repo-check-x-yy
.replace(/repo-check-\d-\d+/gu, 'repo-check-x-yy')
// replace package-json-main-file-size-63ko by package-json-main-file-size-XYZko
.replace(/package-json-main-file-size-\d+ko/gu, 'package-json-main-file-size-XYZko')
)
}

// eslint-disable-next-line no-restricted-syntax
Expand Down

0 comments on commit 4e19933

Please sign in to comment.