Skip to content
Source
Sign inSign up

pullRequestFileJump.test.ts

18 lines777 Bytes

1import { describe, expect, it } from "vite-plus/test";
2import { requestPullRequestFileJump, subscribePullRequestFileJump } from "./pullRequestFileJump";
3​
4describe("pull request file jumps", () => {
5 it("delivers a pick to the screens of its scope, every time it is made", () => {
6 const seen: string[] = [];
7 const other: string[] = [];
8 const stop = subscribePullRequestFileJump("a", (path) => seen.push(path));
9 const stopOther = subscribePullRequestFileJump("b", (path) => other.push(path));
10 requestPullRequestFileJump("a", "src/x.ts");
11 requestPullRequestFileJump("a", "src/x.ts");
12 stop();
13 requestPullRequestFileJump("a", "src/y.ts");
14 stopOther();
15 expect(seen).toEqual(["src/x.ts", "src/x.ts"]);
16 expect(other).toEqual([]);
17 });
18});