| ... | ... | @@ -103,6 +103,30 @@ describe("v2 thread shell lists", () => { |
| 103 | 103 | registry.dispose(); |
| 104 | 104 | }); |
| 105 | 105 | |
| 106 | it("leaves switched-off environments out of navigation", () => { |
| 107 | const { registry, threads, catalogValueAtom } = makeHarness([ |
| 108 | environmentId, |
| 109 | remoteEnvironmentId, |
| 110 | ]); |
| 111 | const dispose = registry.mount(threads.navigationThreadShellsAtom); |
| 112 | const environmentsOf = () => |
| 113 | new Set(registry.get(threads.navigationThreadShellsAtom).map((t) => t.environmentId)); |
| 114 | expect(environmentsOf()).toEqual(new Set([environmentId, remoteEnvironmentId])); |
| 115 | |
| 116 | const setRemoteEnabled = (enabled: boolean) => { |
| 117 | const catalog = registry.get(catalogValueAtom); |
| 118 | const entries = new Map(catalog.entries); |
| 119 | entries.set(remoteEnvironmentId, { ...entries.get(remoteEnvironmentId)!, enabled }); |
| 120 | registry.set(catalogValueAtom, { ...catalog, entries }); |
| 121 | }; |
| 122 | setRemoteEnabled(false); |
| 123 | expect(environmentsOf()).toEqual(new Set([environmentId])); |
| 124 | setRemoteEnabled(true); |
| 125 | expect(environmentsOf()).toEqual(new Set([environmentId, remoteEnvironmentId])); |
| 126 | dispose(); |
| 127 | registry.dispose(); |
| 128 | }); |
| 129 | |
| 106 | 130 | it("shares point and list values without retaining an atom for every listed thread", () => { |
| 107 | 131 | const harness = makeHarness(); |
| 108 | 132 | const snapshot = { |