1import { describe, expect, it } from "vite-plus/test";
2
3import { resolveReviewAvailability } from "./reviewAvailability";
4
5describe("resolveReviewAvailability", () => {
6 it("keeps section navigation available when another section is cached offline", () => {
7 expect(
8 resolveReviewAvailability({
9 hasEnvironmentPresentation: true,
10 isEnvironmentConnected: false,
11 hasCachedSelectedDiff: false,
12 hasAnyCachedDiff: true,
13 }),
14 ).toEqual({
15 showConnectionNotice: true,
16 showSectionToolbar: true,
17 });
18 });
19
20 it("hides section navigation when no review section is available offline", () => {
21 expect(
22 resolveReviewAvailability({
23 hasEnvironmentPresentation: true,
24 isEnvironmentConnected: false,
25 hasCachedSelectedDiff: false,
26 hasAnyCachedDiff: false,
27 }),
28 ).toEqual({
29 showConnectionNotice: true,
30 showSectionToolbar: false,
31 });
32 });
33
34 it("shows cached selected content and navigation while offline", () => {
35 expect(
36 resolveReviewAvailability({
37 hasEnvironmentPresentation: true,
38 isEnvironmentConnected: false,
39 hasCachedSelectedDiff: true,
40 hasAnyCachedDiff: true,
41 }),
42 ).toEqual({
43 showConnectionNotice: false,
44 showSectionToolbar: true,
45 });
46 });
47});