Follow-up from "WIP: Resolve "Search loses branch""
<!--IssueSummary start-->
<details>
<summary>
Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards.
</summary>
- [Work on this issue](https://contributors.gitlab.com/manage-issue?action=work&projectId=278964&issueIid=30103)
- [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=30103)
</details>
<!--IssueSummary end-->
The following discussion from gitlab-ce!28282 should be addressed:
- [ ] @pslaughter started a [discussion](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/28282#note_178665039):
> **note to maintainer:** There is no unit test spec for this file. Technically the behavior is covered by the feature specs so we _should_ be making these changes...
>
> I propose we create a follow up issue to move this `initRefSwitcher` function into it's own module and give it some unit testing love.
issue