Skip to content

Commit

Permalink
fix: stabalize test snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
marufrasully committed Jan 5, 2024
1 parent 4317f41 commit 77ad8f9
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 133 deletions.
20 changes: 19 additions & 1 deletion packages/binding/test/unit/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ const createRange = (range: Range | undefined): string => {
return "0:0-0:0";
};

export const removeUI5PatchVersion = (
completionItems: CompletionItem[]
): void => {
for (const item of completionItems) {
if (item.documentation) {
if (typeof item.documentation === "string") {
const value = item.documentation.replace(/\.(\d+)\//, "");
item.documentation = value;
} else if (item.documentation.kind === "markdown") {
const value = item.documentation.value.replace(/\.(\d+)\//, "");
item.documentation.value = value;
}
}
}
};

export const completionItemToSnapshot = (
item: CompletionItem,
documentation = false
Expand Down Expand Up @@ -99,7 +115,7 @@ export const getViewCompletionProvider =
);
const context = (await getContext(documentPath)) as Context;

return await getCompletionItems({
const result = await getCompletionItems({
ast,
context: contextAdapter ? contextAdapter(context) : context,
cst,
Expand All @@ -108,6 +124,8 @@ export const getViewCompletionProvider =
textDocumentPosition,
tokenVector,
});
removeUI5PatchVersion(result);
return result;
};

type AttributeValidator = (
Expand Down
Loading

0 comments on commit 77ad8f9

Please sign in to comment.