Skip to content

Commit

Permalink
@HiDeoo fixed the tests, thank you sooooo much
Browse files Browse the repository at this point in the history
  • Loading branch information
trueberryless committed Jan 9, 2025
1 parent e466f5b commit d9b28a6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 48 deletions.
3 changes: 1 addition & 2 deletions packages/starlight-spell-checker/libs/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { getValidationData } from "./remark";
import picomatch from "picomatch";

import retextAssuming from "retext-assuming";
import retextCasePolice from "retext-case-police";
// import retextCasePolice from "retext-case-police";
// import retextCliches from "retext-cliches";
import retextContractions from "retext-contractions";
import retextDiacritics from "retext-diacritics";
Expand Down Expand Up @@ -101,7 +101,6 @@ export async function validateTexts(
})
.use(retextUsage, options.usage.enabled)
.use(retextQuotes, options.quotes.enabled)
.use(retextCasePolice, options.casePolice.enabled)
.build();
for (const [filePath, content] of files) {
if (isExcludedPage(filePath, options.exclude)) {
Expand Down
76 changes: 30 additions & 46 deletions packages/starlight-spell-checker/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,40 +65,23 @@ export function expectValidationWarnings(
suggestions?: string[]
][]
) {
console.log(
new RegExp(
`▶ ${path}${validationWarnings
.map(
([word, type, suggestions], index) =>
`.* ${
index < validationWarnings.length - 1 ? "├" : "└"
}${word} - ${type}${
suggestions
? suggestions.length > 0
? ` \(${suggestions.join(", ")}\)`
: " no suggestions"
: ""
}`
)
.join("\n")}`
)
);
expect(output).toMatch(
new RegExp(
`▶ ${path}${validationWarnings
.map(
([word, type, suggestions], index) =>
`.* ${
index < validationWarnings.length - 1 ? "├" : "└"
}${word} - ${type}${
suggestions
? suggestions.length > 0
? ` \(${suggestions.join(", ")}\)`
: " no suggestions"
: ""
}`
)
.join("\n")}`
`▶ ${path}
${validationWarnings
.map(
([word, type, suggestions], index) =>
`.* ${
index < validationWarnings.length - 1 ? "├" : "└"
}${word} - ${type}${
suggestions
? suggestions.length > 0
? ` \\\(${suggestions.join(", ")}\\\)`
: " no suggestions"
: ""
}`
)
.join("\n")}`
)
);
}
Expand Down Expand Up @@ -128,20 +111,21 @@ export function expectValidationErrors(
) {
expect(output).toMatch(
new RegExp(
`▶ ${path}${validationErrors
.map(
([word, type, suggestions], index) =>
`.* ${
index < validationErrors.length - 1 ? "├" : "└"
}${word} - ${type}${
suggestions
? suggestions.length > 0
? ` \(${suggestions.join(", ")}\)`
: " no suggestions"
: ""
}`
)
.join("\n")}`
`▶ ${path}
${validationErrors
.map(
([word, type, suggestions], index) =>
`.* ${
index < validationErrors.length - 1 ? "├" : "└"
}${word} - ${type}${
suggestions
? suggestions.length > 0
? ` \\\(${suggestions.join(", ")}\\\)`
: " no suggestions"
: ""
}`
)
.join("\n")}`
)
);
}

0 comments on commit d9b28a6

Please sign in to comment.