Skip to content

Commit d2241dd

Browse files
jorj-pinedajuliusmarminge
authored andcommitted
test(web): cover partial ref queries containing a space
Searching "hello w" has to surface an existing hello-world, since that is the name the ref was created under. The sanitized fallback already handles this; pin it so a future change to the filter cannot silently break it.
1 parent c5c260d commit d2241dd

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎apps/web/src/components/BranchToolbar.logic.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,19 @@ describe("shouldIncludeBranchPickerItem", () => {
744744
).toBe(true);
745745
});
746746

747+
// A partial query has to reach the ref it would have been created as, so
748+
// searching "hello w" still finds an existing hello-world.
749+
it("surfaces a ref from a partial query containing a space", () => {
750+
expect(
751+
shouldIncludeBranchPickerItem({
752+
itemValue: "hello-world",
753+
normalizedQuery: "hello w",
754+
createBranchItemValue: null,
755+
checkoutPullRequestItemValue: null,
756+
}),
757+
).toBe(true);
758+
});
759+
747760
it("excludes refs matching neither the raw nor the sanitized query", () => {
748761
expect(
749762
shouldIncludeBranchPickerItem({

0 commit comments

Comments
 (0)