Keep the saved order of recent repositories; it was reversed on every start
This commit is contained in:
+10
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { addRecent, MAX_RECENTS } from "./recents";
|
||||
import { addRecent, MAX_RECENTS, mergeRecents } from "./recents";
|
||||
|
||||
describe("addRecent", () => {
|
||||
it("puts the path first", () => {
|
||||
@@ -16,3 +16,12 @@ describe("addRecent", () => {
|
||||
expect(out).not.toContain(`/r${MAX_RECENTS - 1}`);
|
||||
});
|
||||
});
|
||||
|
||||
describe("mergeRecents", () => {
|
||||
it("keeps the saved order", () => {
|
||||
expect(mergeRecents([], ["/a", "/b", "/c"])).toEqual(["/a", "/b", "/c"]);
|
||||
});
|
||||
it("puts a path opened before the settings arrived first, once", () => {
|
||||
expect(mergeRecents(["/b"], ["/a", "/b", "/c"])).toEqual(["/b", "/a", "/c"]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user