| 129 | |
| 130 | // TestingScreen just mounts some components that we can check in the unit test. |
| 131 | const TestingScreen = () => { |
| 132 | const { |
| 133 | proxy, |
| 134 | userProxy, |
| 135 | isFetched, |
| 136 | isLoading, |
| 137 | latenciesLoaded, |
| 138 | clearProxy, |
| 139 | setProxy, |
| 140 | } = useProxy(); |
| 141 | |
| 142 | return ( |
| 143 | <> |
| 144 | <div |
| 145 | data-testid="latenciesLoaded" |
| 146 | title={latenciesLoaded.toString()} |
| 147 | ></div> |
| 148 | <div data-testid="isFetched" title={isFetched.toString()}></div> |
| 149 | <div data-testid="isLoading" title={isLoading.toString()}></div> |
| 150 | <div data-testid="preferredProxy" title={proxy.proxy?.id}></div> |
| 151 | <div data-testid="userProxy" title={userProxy?.id}></div> |
| 152 | <button data-testid="clearProxy" onClick={clearProxy}></button> |
| 153 | <div data-testid="userSelectProxyData"></div> |
| 154 | <button |
| 155 | data-testid="userSelectProxy" |
| 156 | onClick={() => { |
| 157 | const data = screen.getByTestId("userSelectProxyData"); |
| 158 | if (data.innerText) { |
| 159 | setProxy(JSON.parse(data.innerText)); |
| 160 | } |
| 161 | }} |
| 162 | ></button> |
| 163 | </> |
| 164 | ); |
| 165 | }; |
| 166 | |
| 167 | interface ProxyContextSelectionTest { |
| 168 | // Regions is the list of regions to return via the "api" response. |